/* 写实人像生图 —— 主页面与登录页共用样式（深色、玻璃面板、青蓝到紫的渐变点缀） */

/* ============================================================ 基础变量 */
:root {
  --bg: #090b11;
  --panel-solid: #141927;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --text: #e8ecf5;
  --text-2: #a3acc0;
  --text-3: #6f788c;
  --accent-1: #22d3ee;
  --accent-2: #6366f1;
  --accent-3: #a855f7;
  --accent-grad: linear-gradient(135deg, #22d3ee 0%, #6366f1 55%, #a855f7 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --muted: #64748b;
  --focus: #67e8f9;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --topbar-h: 58px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }

img { display: block; max-width: 100%; }

button,
input,
textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

h1, h2, h3, p, figure { margin: 0; }

::selection { background: rgba(99, 102, 241, .45); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 细滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .26); }

/* 背景里几团柔和的光，给玻璃面板一点可以“透”的东西 */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 6% -8%, rgba(34, 211, 238, .14), transparent 62%),
    radial-gradient(50vw 50vh at 100% 0%, rgba(168, 85, 247, .13), transparent 60%),
    radial-gradient(70vw 60vh at 55% 112%, rgba(99, 102, 241, .14), transparent 62%),
    linear-gradient(180deg, #0a0c13 0%, #080a0f 100%);
}

/* ============================================================ 通用部件 */
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, box-shadow .2s, color .15s, transform .1s, opacity .15s, filter .15s;
}

.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }

.btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 6px 20px rgba(99, 102, 241, .32), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 8px 28px rgba(99, 102, 241, .5), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .24);
}

.btn-ghost { color: var(--text-2); }

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-xs { height: 26px; padding: 0 8px; gap: 4px; font-size: 12px; border-radius: 8px; }
.btn-xs .icon { width: 14px; height: 14px; }
.btn-lg { height: 48px; padding: 0 18px; font-size: 16px; font-weight: 600; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }

/* 加载中的按钮：转圈代替图标，不变灰太多 */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .28);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}

.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-idle-icon { display: none; }
.btn.is-loading:disabled { opacity: .9; cursor: progress; }

.spinner-lg {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, .14);
  border-top-color: var(--accent-1);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.chip strong { color: var(--text); font-weight: 600; }

.form-error {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, .32);
  background: rgba(248, 113, 113, .1);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

/* ============================================================ 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
  background: rgba(10, 12, 19, .78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 0 10px rgba(99, 102, 241, .45)); }

.brand-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  background: linear-gradient(90deg, #f1f5ff 0%, #c7d2fe 60%, #e9d5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 34px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
}

.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-2);
}

/* ============================================================ 页面骨架 */
.page-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 16px max(20px, env(safe-area-inset-right, 0px)) 16px max(20px, env(safe-area-inset-left, 0px));
}

/* 玻璃面板 */
.panel,
.history {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .022));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 12px 40px rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel,
  .history { background: rgba(20, 24, 36, .94); }
}

.panel { display: flex; flex-direction: column; scroll-margin-top: calc(var(--topbar-h) + 12px); }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 14px 18px 8px;
}

.panel-title,
.history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text-2);
  white-space: nowrap;
}

.panel-title::before,
.history-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent-grad);
}

.panel-body { padding: 4px 18px 18px; }

/* 中屏：左边设置，右边上下放过程和结果 */
@media (min-width: 760px) and (max-width: 1099px) {
  .layout {
    grid-template-columns: minmax(300px, 350px) minmax(0, 1fr);
    grid-template-areas:
      "settings progress"
      "settings result";
    align-items: start;
  }

  .panel-settings {
    grid-area: settings;
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 32px);
    max-height: calc(100dvh - var(--topbar-h) - 32px);
    overflow: hidden;
  }

  .panel-settings .panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .panel-progress { grid-area: progress; }
  .panel-result { grid-area: result; }
}

/* 大屏：三栏 */
@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(320px, 400px);
    align-items: start;
  }
}

@media (min-width: 1500px) {
  .layout { grid-template-columns: 360px minmax(0, 1fr) 440px; }
}

/* 大屏且够高：做成专业工具那样整屏固定，各栏自己滚动 */
@media (min-width: 1100px) and (min-height: 660px) {
  .page-app {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .layout {
    flex: 1;
    min-height: 0;
    align-items: stretch;
    padding-bottom: 12px;
  }

  .panel { min-height: 0; overflow: hidden; }

  .panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .history { flex: none; }
}

.only-narrow { display: none !important; }

@media (max-width: 759px) {
  .only-narrow { display: inline-flex !important; }
}

@media (min-width: 1100px) {
  .only-stacked { display: none !important; }
}

/* ============================================================ 左栏：设置 */
.field { padding: 14px 0 16px; border-top: 1px solid rgba(255, 255, 255, .06); }
.field:first-child { padding-top: 2px; border-top: 0; }

.field-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.step-no {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 6px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.field-title { font-size: 15px; font-weight: 600; color: var(--text); }

.field-extra {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-3);
}

.field-extra.is-picked { color: var(--accent-1); font-weight: 600; }

.field-foot { margin-top: 9px; font-size: 12px; line-height: 1.5; color: var(--text-3); }

.field-msg {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

.field-msg.is-error { color: var(--bad); }
.field-msg.is-ok { color: var(--ok); }
.field-msg.is-warn { color: var(--warn); }

/* ---- 选脸 ---- */
.face-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 7px;
}

.face-card { position: relative; display: block; min-width: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.face-body {
  display: block;
  padding: 2px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  transition: background .2s, box-shadow .2s, transform .15s;
}

.face-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 10px;
  background: #161b27;
}

.face-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform .35s ease, opacity .3s;
}

.face-thumb img.is-broken { opacity: 0; }

.face-code {
  display: block;
  padding: 3px 2px 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.face-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  color: #4f46e5;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .2s, transform .2s;
}

.face-check .icon { width: 12px; height: 12px; stroke-width: 3; }

.face-card:hover .face-body { background: rgba(255, 255, 255, .14); }
.face-card:hover .face-thumb img { transform: scale(1.05); }
.face-card:active .face-body { transform: scale(.97); }

.face-card input:checked + .face-body {
  background: var(--accent-grad);
  box-shadow: 0 6px 18px rgba(99, 102, 241, .38);
}

.face-card input:checked + .face-body .face-code { color: #fff; font-weight: 600; }
.face-card input:checked + .face-body .face-check { opacity: 1; transform: none; }

.face-card input:focus-visible + .face-body {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.face-skel {
  aspect-ratio: 4 / 6;
  border-radius: 12px;
  background: linear-gradient(100deg, rgba(255, 255, 255, .04) 30%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.face-empty { grid-column: 1 / -1; padding: 10px 0; font-size: 13px; color: var(--text-3); }

/* ---- 参考图拖放区 ---- */
.dropzone {
  position: relative;
  border: 1.5px dashed rgba(148, 163, 184, .35);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}

.dropzone:hover { border-color: rgba(103, 232, 249, .6); background: rgba(34, 211, 238, .05); }

.dropzone.is-over,
.is-dragging-file .dropzone {
  border-color: var(--accent-1);
  background: rgba(34, 211, 238, .08);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .12);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .16);
  cursor: default;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 14px 18px;
  text-align: center;
}

.dz-icon {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--accent-1);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, .45));
}

.dz-title { font-weight: 600; color: var(--text); }
.dz-sub { font-size: 12px; color: var(--text-3); }

.dz-preview { display: flex; gap: 12px; padding: 10px; }

.dz-thumb {
  width: 96px;
  flex: none;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 10px;
  background: #0b0e15;
}

.dz-thumb img { width: 100%; height: 100%; object-fit: contain; }

.dz-meta { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }

.dz-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.dz-info { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.dz-reuse { font-size: 12px; color: var(--accent-1); }
.dz-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }

.dz-drop-hint {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  border-radius: inherit;
  background: rgba(8, 12, 20, .78);
  color: var(--accent-1);
  font-weight: 600;
  pointer-events: none;
}

.dropzone.is-over .dz-drop-hint,
.is-dragging-file .dz-drop-hint { display: grid; }

.hint-touch { display: none; }

@media (hover: none) {
  .hint-mouse { display: none !important; }
  .hint-touch { display: inline; }
  p.hint-touch { display: block; }
}

/* ---- 参考程度 ---- */
.strength-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.strength-card { display: block; min-width: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.strength-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 10px 11px 11px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .12s;
}

.strength-top { display: flex; align-items: center; gap: 7px; min-width: 0; }

.strength-no {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 7px;
  background: rgba(255, 255, 255, .08);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.strength-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.meter { display: flex; align-items: flex-end; gap: 2px; margin-left: auto; flex: none; height: 14px; }

.meter i {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .13);
}

.meter i:nth-child(1) { height: 5px; }
.meter i:nth-child(2) { height: 8px; }
.meter i:nth-child(3) { height: 11px; }
.meter i:nth-child(4) { height: 14px; }

.strength-card input[value="4"] + .strength-body .meter i,
.strength-card input[value="3"] + .strength-body .meter i:nth-child(-n+3),
.strength-card input[value="2"] + .strength-body .meter i:nth-child(-n+2),
.strength-card input[value="1"] + .strength-body .meter i:nth-child(1) { background: rgba(103, 232, 249, .55); }

.strength-desc { font-size: 12px; line-height: 1.5; color: var(--text-3); }

.strength-card:hover .strength-body { border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); }
.strength-card:active .strength-body { transform: scale(.985); }

.strength-card input:checked + .strength-body {
  border-color: transparent;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, .12), rgba(168, 85, 247, .12)) padding-box,
    linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
    var(--accent-grad) border-box;
  box-shadow: 0 6px 22px rgba(99, 102, 241, .22);
}

.strength-card input:checked + .strength-body .strength-no { background: var(--accent-grad); color: #fff; }
.strength-card input:checked + .strength-body .strength-desc { color: var(--text-2); }
.strength-card input:checked + .strength-body .meter i { box-shadow: 0 0 6px rgba(34, 211, 238, .35); }

.strength-card input:focus-visible + .strength-body {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---- 补充说明 ---- */
.textarea {
  display: block;
  width: 100%;
  min-height: 78px;
  max-height: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  line-height: 1.55;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}

.textarea::placeholder { color: var(--text-3); }
.textarea:hover { border-color: rgba(255, 255, 255, .18); }

.textarea:focus {
  outline: none;
  border-color: rgba(103, 232, 249, .7);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}

.note-count {
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.note-count.is-near { color: var(--warn); }
.note-count.is-full { color: var(--bad); }

/* ---- 开始生成 ---- */
.submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, .06);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: rgba(14, 17, 27, .86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.submit-hint {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.submit-hint.is-ready { color: var(--ok); }

/* ============================================================ 中栏：生成过程 */
.job-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

/* ---- 没任务时的引导 ---- */
.guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26px 6px 20px;
  text-align: center;
}

.guide-art { position: relative; width: 116px; height: 116px; margin-bottom: 6px; }

.guide-orb {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .55), transparent 38%),
    var(--accent-grad);
  box-shadow: 0 0 60px rgba(99, 102, 241, .45), inset 0 -10px 30px rgba(15, 10, 40, .45);
  animation: float 6s ease-in-out infinite;
}

.guide-art::before,
.guide-art::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, .16);
  animation: spin 40s linear infinite;
}

.guide-art::after {
  inset: -18px;
  border: 1px solid transparent;
  border-top-color: rgba(103, 232, 249, .5);
  border-right-color: rgba(168, 85, 247, .35);
  animation-duration: 9s;
}

.guide-title { font-size: 18px; font-weight: 600; color: var(--text); }

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 300px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  text-align: left;
  transition: border-color .25s, background-color .25s;
}

.guide-no {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  transition: background-color .25s, color .25s;
}

.guide-text { color: var(--text-2); }

.guide-ok {
  margin-left: auto;
  color: var(--ok);
  font-weight: 700;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .25s, transform .25s;
}

.guide-steps li.is-done { border-color: rgba(52, 211, 153, .25); background: rgba(52, 211, 153, .06); }
.guide-steps li.is-done .guide-no { background: rgba(52, 211, 153, .18); color: var(--ok); }
.guide-steps li.is-done .guide-ok { opacity: 1; transform: none; }

.guide-foot { max-width: 300px; font-size: 12px; color: var(--text-3); }

.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 10px;
  text-align: center;
  color: var(--text-2);
}

.state-box.is-error { color: var(--bad); }

/* ---- 任务视图 ---- */
.run {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 4px;
}

/* 等待动效：参考图居中，外面是光环、轨道光点、粒子，里面是扫描光带 */
.fx {
  --fx-a: #22d3ee;
  --fx-b: #a855f7;
  --fx-a-soft: rgba(34, 211, 238, .24);
  --fx-line: rgba(103, 232, 249, .16);
  --ring-speed: 4s;
  --scan-speed: 2.4s;
  --orbit-speed: 7s;
  --fx-img-filter: none;
  position: relative;
  width: min(300px, calc(100% / 1.32));
  aspect-ratio: 1 / 1;
  margin: 34px auto 14px;
  isolation: isolate;
}

.fx-canvas {
  position: absolute;
  top: -16%;
  left: -16%;
  width: 132%;
  height: 132%;
  z-index: 0;
  pointer-events: none;
}

.fx-halo {
  position: absolute;
  inset: 6%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--fx-a-soft), transparent 75%);
  animation: breathe 3.2s ease-in-out infinite;
}

.fx-ring {
  position: absolute;
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
}

.fx-ring-1 {
  inset: 1%;
  background: conic-gradient(from 0deg, transparent 0deg 200deg, var(--fx-a) 290deg, var(--fx-b) 352deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: spin var(--ring-speed) linear infinite;
}

.fx-ring-2 {
  inset: 7.5%;
  border: 1px dashed var(--fx-line);
  opacity: .9;
  animation: spin calc(var(--ring-speed) * 6) linear infinite reverse;
}

.fx-orbit {
  position: absolute;
  inset: -2.5%;
  z-index: 1;
  border-radius: 50%;
  animation: spin var(--orbit-speed) linear infinite;
}

.fx-orbit i {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 3px var(--fx-a), 0 0 24px 8px var(--fx-a-soft);
}

.fx-frame {
  position: absolute;
  inset: 15%;
  z-index: 2;
  padding: 2px;
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 0 36px var(--fx-a-soft);
}

/* 流光边框：一块比框大得多的锥形渐变在框后面转 */
.fx-frame::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: conic-gradient(from 0deg, var(--fx-a), var(--fx-b), transparent 30%, transparent 50%, var(--fx-a) 62%, var(--fx-b) 80%, transparent 92%, var(--fx-a));
  animation: spin calc(var(--ring-speed) * 1.3) linear infinite;
}

.fx-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 20px;
  background: #0b0e16;
}

.fx-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.03);
  filter: var(--fx-img-filter);
  transition: filter 1.2s ease;
}

.fx-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--fx-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--fx-line) 1px, transparent 1px);
  background-size: 24px 24px;
  animation: grid-glow 3s ease-in-out infinite;
}

.fx-scan {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34%;
  background: linear-gradient(180deg, transparent 0%, var(--fx-a-soft) 42%, var(--fx-a) 50%, var(--fx-a-soft) 58%, transparent 100%);
  opacity: .85;
  animation: scan var(--scan-speed) ease-in-out infinite alternate;
  will-change: transform;
}

.fx-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--fx-a);
  opacity: .85;
}

.fx-tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.fx-tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.fx-bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.fx-br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

.fx-badge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 4px 11px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(8, 10, 16, .8);
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.fx-badge-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--fx-a);
  box-shadow: 0 0 8px var(--fx-a);
  animation: blink 1.2s ease-in-out infinite;
}

/* 不同阶段换颜色和节奏 */
.fx[data-stage="queued"] {
  --fx-a: #818cf8; --fx-b: #94a3b8; --fx-a-soft: rgba(129, 140, 248, .2); --fx-line: rgba(165, 180, 252, .12);
  --ring-speed: 9s; --scan-speed: 4.5s; --orbit-speed: 14s;
  --fx-img-filter: grayscale(.7) blur(3px) brightness(.7);
}

.fx[data-stage="describing"] {
  --fx-a: #22d3ee; --fx-b: #3b82f6; --fx-a-soft: rgba(34, 211, 238, .24); --fx-line: rgba(103, 232, 249, .18);
  --ring-speed: 4s; --scan-speed: 2.2s; --orbit-speed: 6s;
  --fx-img-filter: grayscale(.35) blur(1.5px) brightness(.85);
}

.fx[data-stage="planning"] {
  --fx-a: #a78bfa; --fx-b: #f0abfc; --fx-a-soft: rgba(167, 139, 250, .24); --fx-line: rgba(196, 181, 253, .16);
  --ring-speed: 5s; --scan-speed: 3s; --orbit-speed: 8s;
  --fx-img-filter: saturate(.8) blur(1px) brightness(.9);
}

.fx[data-stage="generating"] {
  --fx-a: #38bdf8; --fx-b: #c084fc; --fx-a-soft: rgba(56, 189, 248, .28); --fx-line: rgba(125, 211, 252, .16);
  --ring-speed: 2.2s; --scan-speed: 1.5s; --orbit-speed: 3.5s;
  --fx-img-filter: saturate(.9) blur(.6px);
}

.fx[data-stage="checking"] {
  --fx-a: #34d399; --fx-b: #22d3ee; --fx-a-soft: rgba(52, 211, 153, .24); --fx-line: rgba(110, 231, 183, .16);
  --ring-speed: 3.5s; --scan-speed: 2s; --orbit-speed: 6s;
}

.fx[data-stage="done"] { --fx-a: #34d399; --fx-b: #22d3ee; --fx-a-soft: rgba(52, 211, 153, .18); }

.fx[data-stage="failed"] {
  --fx-a: #f87171; --fx-b: #fb923c; --fx-a-soft: rgba(248, 113, 113, .16);
  --fx-img-filter: grayscale(.85) brightness(.6);
}

/* 结束后静止：只留一圈完整的光环 */
.fx.is-still .fx-scan,
.fx.is-still .fx-grid,
.fx.is-still .fx-orbit,
.fx.is-still .fx-ring-2,
.fx.is-still .fx-canvas { display: none; }

.fx.is-still .fx-ring-1 {
  background: conic-gradient(var(--fx-a), var(--fx-b), var(--fx-a));
  opacity: .55;
  animation: none;
}

.fx.is-still .fx-frame::before,
.fx.is-still .fx-halo,
.fx.is-still .fx-badge-dot { animation: none; }

/* 看不见的时候（切到后台、滚出屏幕）把动画停掉 */
.fx.is-paused,
.fx.is-paused *,
.fx.is-paused *::before,
.fx.is-paused *::after { animation-play-state: paused !important; }

/* ---- 计时器 ---- */
/* 压在粒子画布上面，粒子飘过时不挡字 */
.timer-block { position: relative; z-index: 1; margin-top: -2px; text-align: center; }

.timer-label { font-size: 12px; letter-spacing: .12em; color: var(--text-3); }

.timer {
  font-family: var(--mono);
  font-size: 52px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 0%, #b9c5e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status-line { min-height: 21px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.status-line strong { color: var(--text); font-weight: 600; }
.status-line.is-ok strong { color: var(--ok); }
.status-line.is-bad strong { color: var(--bad); }

/* ---- 阶段条 ---- */
.stages {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  max-width: 580px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* 每一步左边的连线 */
.stage::before {
  content: "";
  position: absolute;
  top: 11px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, .1);
  transition: background .4s;
}

.stage:first-child::before { display: none; }

.stage.is-done::before,
.stage.is-active::before { background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); }

.stage-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: #121725;
  color: #fff;
  transition: background .3s, border-color .3s, box-shadow .3s;
}

.stage-dot .icon { width: 13px; height: 13px; stroke-width: 3; }

.stage.is-done .stage-dot { border-color: transparent; background: var(--accent-grad); }

.stage.is-active .stage-dot {
  border-color: var(--accent-1);
  background: #0d1a25;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .14);
}

.stage.is-active .stage-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 10px var(--accent-1);
}

.stage.is-active .stage-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid var(--accent-1);
  border-radius: 50%;
  animation: pulse-ring 1.6s ease-out infinite;
}

.stage.is-failed .stage-dot { border-color: var(--bad); background: rgba(248, 113, 113, .2); color: var(--bad); }

.stage-name { max-width: 7em; line-height: 1.3; word-break: break-all; }
.stage.is-done .stage-name { color: var(--text-2); }
.stage.is-active .stage-name { color: var(--text); font-weight: 600; }
.stage.is-failed .stage-name { color: var(--bad); font-weight: 600; }

/* ---- 网络提示、轮播提示、说明卡片 ---- */
.poll-warn {
  padding: 6px 12px;
  border: 1px solid rgba(251, 191, 36, .28);
  border-radius: 10px;
  background: rgba(251, 191, 36, .08);
  color: var(--warn);
  font-size: 12px;
}

.tip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 540px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  transition: opacity .3s ease, transform .3s ease;
}

.tip.is-out { opacity: 0; transform: translateY(4px); }
.tip-icon { color: var(--warn); }

.info-card {
  width: 100%;
  max-width: 580px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
}

.plan-card {
  border-color: rgba(129, 140, 248, .28);
  background: linear-gradient(135deg, rgba(34, 211, 238, .07), rgba(168, 85, 247, .08));
  animation: rise .5s ease both;
}

.info-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.plan-card .info-title .icon { width: 16px; height: 16px; color: #c4b5fd; }

.info-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================ 右栏：结果 */
.result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  border: 1px dashed rgba(255, 255, 255, .1);
  border-radius: 16px;
  color: var(--text-3);
  text-align: center;
}

.result-empty-icon {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .7;
}

.result-waiting { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }

.skeleton-frame {
  position: relative;
  height: min(46vh, 440px);
  min-height: 220px;
  aspect-ratio: 2 / 3;
  max-width: 100%;
  margin-bottom: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, .05) 0 18%, transparent 19%),
    rgba(255, 255, 255, .035);
}

.skeleton-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .08) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shine 2.2s ease-in-out infinite;
}

.result-waiting-title { font-weight: 600; color: var(--text-2); }
.result-waiting-sub { font-size: 12px; color: var(--text-3); }

.result-figure {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  background: #0b0e15;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  cursor: zoom-in;
  transition: border-color .2s, box-shadow .2s;
}

.result-figure:hover { border-color: rgba(103, 232, 249, .4); box-shadow: 0 16px 44px rgba(0, 0, 0, .5), 0 0 0 1px rgba(103, 232, 249, .15); }

.result-figure img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  margin: 0 auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity .4s ease;
}

.result-figure.is-loaded img { opacity: 1; }

.result-figure-loading,
.result-figure-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
}

.result-figure-loading .spinner { display: inline-block; width: 28px; height: 28px; border-width: 3px; border-color: rgba(255, 255, 255, .14); border-top-color: var(--accent-1); }
.result-figure.is-loaded .result-figure-loading,
.result-figure.is-error .result-figure-loading { display: none; }
.result-figure-error { color: var(--warn); background: rgba(10, 12, 18, .7); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.badge-ok { border-color: rgba(52, 211, 153, .38); background: rgba(52, 211, 153, .12); color: #6ee7b7; }
.badge-warn { border-color: rgba(251, 191, 36, .38); background: rgba(251, 191, 36, .12); color: #fcd34d; }
.badge-plain { border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .06); color: var(--text-2); font-weight: 500; }

.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.result-actions .btn { flex: 1 1 auto; }

.sub-title { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }

.checks { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
}

.check-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
}

.check-icon .icon { width: 14px; height: 14px; stroke-width: 2.8; }
.check.is-pass .check-icon { background: rgba(52, 211, 153, .16); color: var(--ok); }
.check.is-fail .check-icon { background: rgba(248, 113, 113, .16); color: var(--bad); }
.check.is-warn .check-icon { background: rgba(251, 191, 36, .16); color: var(--warn); }
.check.is-skip .check-icon { background: rgba(148, 163, 184, .14); color: var(--muted); }
.check.is-fail { border-color: rgba(248, 113, 113, .2); }
.check.is-warn { border-color: rgba(251, 191, 36, .18); }

.check-body { min-width: 0; padding-top: 1px; font-size: 13px; line-height: 1.55; }
.check-name { margin-right: 6px; font-weight: 600; color: var(--text); }
.check-text { color: var(--text-2); word-break: break-word; }
.check.is-skip .check-text { color: var(--text-3); }

.notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(99, 102, 241, .22);
  border-radius: 12px;
  background: rgba(99, 102, 241, .07);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
  list-style: none;
}

.notes li { position: relative; padding-left: 14px; word-break: break-word; }

.notes li::before {
  content: "";
  position: absolute;
  top: .65em;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #818cf8;
}

.result-failed .btn { margin-top: 12px; }

.fail-card {
  padding: 14px 16px;
  border: 1px solid rgba(248, 113, 113, .42);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(248, 113, 113, .15), rgba(248, 113, 113, .05));
}

.fail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: #fca5a5; font-weight: 600; }
.fail-text { color: #fde4e4; font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.retry-hint { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--text-3); text-align: center; }

/* ============================================================ 底部：历史记录 */
.history {
  flex: none;
  margin: 0 max(20px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  padding: 10px 0 8px;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}

.history-head { display: flex; align-items: center; gap: 10px; min-height: 28px; padding: 0 16px 6px; }
.history-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.history-status { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-3); }
.history-status.is-error { color: var(--bad); }
.history-status:empty { display: none; }
.history-status:empty + .btn { margin-left: auto; }

.history-strip-wrap { position: relative; }

.history-strip {
  display: flex;
  gap: 10px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.history-empty { padding: 18px 2px; font-size: 13px; color: var(--text-3); white-space: nowrap; }

.hcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 112px;
  flex: none;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s, border-color .2s, background-color .2s, box-shadow .2s;
}

.hcard:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); }
.hcard:active { transform: scale(.98); }

.hcard.is-current {
  border-color: transparent;
  background:
    linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
    var(--accent-grad) border-box;
  box-shadow: 0 6px 20px rgba(99, 102, 241, .3);
}

.hcard-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: #10141e;
}

.hcard-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.hcard-thumb img.is-broken { opacity: 0; }

/* 进行中：缩略图上一道流光 */
.hcard.is-active-job .hcard-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(103, 232, 249, .28) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: shine 2s ease-in-out infinite;
}

.hcard-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 10px);
  height: 20px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(8, 10, 16, .8);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.hcard-badge .icon { width: 11px; height: 11px; stroke-width: 3; }
.hcard-badge .dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.hcard-badge.is-running { color: #67e8f9; }
.hcard-badge.is-queued { color: #c7d2fe; }
.hcard-badge.is-done { color: #6ee7b7; }
.hcard-badge.is-failed { color: #fca5a5; }
.hcard-badge.is-running .dot,
.hcard-badge.is-queued .dot { animation: blink 1.1s ease-in-out infinite; }

.hcard-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 0 2px 1px; }
.hcard-time { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hcard-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--text-3); }

.strip-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(15, 18, 28, .9);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  transform: translateY(-60%);
  transition: background-color .15s;
}

.strip-nav:hover { background: rgba(40, 46, 64, .95); }
.strip-prev { left: 6px; }
.strip-next { right: 6px; }

@media (hover: none) {
  .strip-nav { display: none !important; }
}

@media (min-width: 1100px) and (min-height: 660px) and (max-height: 860px) {
  .hcard { width: 94px; }
  .history { padding-top: 8px; }
}

/* ============================================================ 小提示条 */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(20, 24, 36, .95);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in .25s ease both;
}

.toast.is-ok { border-color: rgba(52, 211, 153, .45); }
.toast.is-error { border-color: rgba(248, 113, 113, .5); }
.toast.is-leaving { animation: toast-out .25s ease both; }
.toast .btn { margin-left: 4px; }

/* ============================================================ 全屏层：放大看、和原图对比 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: rgba(5, 7, 11, .96);
  animation: fade-in .18s ease both;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .overlay {
    background: rgba(5, 7, 11, .86);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}

.overlay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.overlay-title { margin-right: auto; font-weight: 600; white-space: nowrap; }
.overlay-tools { display: flex; align-items: center; gap: 4px; }

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s;
}

.tool-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); }
.tool-btn:active { transform: scale(.96); }
.tool-pct { min-width: 64px; font-variant-numeric: tabular-nums; }
.tool-close { margin-left: 6px; }

.overlay-hint {
  flex: none;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* 放大看 */
.lb-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.lb-stage.is-panning { cursor: grabbing; }

.lb-img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  opacity: 0;
  transition: opacity .2s;
  -webkit-user-drag: none;
}

.lb-img.is-ready { opacity: 1; }

/* 和原图对比 */
.cmp-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 14px;
}

.cmp-frame {
  --pos: 50%;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #0b0e15;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cmp-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.cmp-after {
  -webkit-clip-path: inset(0 0 0 var(--pos));
  clip-path: inset(0 0 0 var(--pos));
}

.cmp-divider { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 0; }

.cmp-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, .6), 0 0 16px rgba(103, 232, 249, .55);
}

.cmp-handle {
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(15, 18, 28, .9);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
  cursor: ew-resize;
}

.cmp-label {
  position: absolute;
  top: 10px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(8, 10, 16, .75);
  font-size: 12px;
  pointer-events: none;
  transition: opacity .2s;
}

.cmp-label-left { left: 10px; }
.cmp-label-right { right: 10px; }
.cmp-frame.hide-left .cmp-label-left,
.cmp-frame.hide-right .cmp-label-right { opacity: 0; }

.cmp-side { display: flex; gap: 12px; width: 100%; height: 100%; }

.cmp-pane { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; min-height: 0; }

.cmp-pane img {
  flex: 1;
  width: 100%;
  min-height: 0;
  max-width: none;
  object-fit: contain;
  border-radius: 12px;
  background: #0b0e15;
}

.cmp-pane figcaption { flex: none; text-align: center; font-size: 13px; color: var(--text-2); }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 11px;
  background: rgba(255, 255, 255, .05);
}

.seg-btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}

.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--accent-grad); color: #fff; font-weight: 600; }

/* ============================================================ 登录页 */
.page-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
}

.login-card {
  width: min(100%, 380px);
  padding: 32px 28px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 24px 70px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  animation: rise .45s ease both;
}

.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; text-align: center; }
.login-brand .brand-mark { width: 54px; height: 54px; }
.login-title { font-size: 22px; }
.login-sub { font-size: 13px; color: var(--text-3); }

.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 13px; color: var(--text-2); }

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(0, 0, 0, .25);
  color: var(--text);
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}

.input::placeholder { color: var(--text-3); }
.input:hover { border-color: rgba(255, 255, 255, .2); }

.input:focus {
  outline: none;
  border-color: rgba(103, 232, 249, .7);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }

.pw-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
}

.pw-toggle:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.login-card .form-error { margin: 0 0 14px; }
.login-card .btn-lg { margin-top: 6px; }
.login-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ============================================================ 小屏 */
@media (max-width: 759px) {
  .topbar { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .brand-mark { width: 26px; height: 26px; }
  .brand-title { font-size: 16px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn-sm { padding: 0 9px; }
  .user-chip { padding-right: 10px; }
  .user-name { max-width: 22vw; }
  .layout { gap: 12px; padding: 12px max(12px, env(safe-area-inset-left, 0px)); }
  .panel-head { padding: 12px 14px 6px; }
  .panel-body { padding: 4px 14px 14px; }
  .submit-bar { padding-left: 14px; padding-right: 14px; }
  .history { margin-left: max(12px, env(safe-area-inset-left, 0px)); margin-right: max(12px, env(safe-area-inset-right, 0px)); }
  .history-head { padding: 0 12px 6px; }
  .history-strip { padding: 4px 12px 8px; }
  .timer { font-size: 44px; }
  .fx { margin-top: 30px; }
  .result-figure img { max-height: none; }
  /* 手机上输入框字号不小于 16px，免得一点就整页放大 */
  .textarea,
  .input { font-size: 16px; }
}

@media (max-width: 430px) {
  .brand-title { font-size: 15px; }
  .user-chip { padding: 0 10px; }
  .user-chip .avatar,
  #jump-history span { display: none; }
  .user-name { max-width: 20vw; }
  .tool-pct { min-width: 52px; }
  .overlay-bar { gap: 6px; }
}

@media (max-width: 519px) {
  .stage-name { display: none; }
  .stages { max-width: 340px; }
}

/* 大屏固定布局里，成品图别把下面的结论挤出去太多 */
@media (min-width: 1100px) and (min-height: 660px) {
  /* 留出下面的结论徽章和三个按钮，不用滚动就看得到 */
  .result-figure img { max-height: calc(100vh - 470px); max-height: calc(100dvh - 470px); min-height: 200px; }
  .fx { width: min(280px, 30vh, calc(100% / 1.32)); }
  .timer { font-size: clamp(40px, 6vh, 56px); }
}

/* ============================================================ 动画 */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@keyframes shine { to { transform: translateX(100%); } }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes breathe {
  0%, 100% { transform: scale(.92); opacity: .7; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes scan {
  from { transform: translateY(-100%); }
  to { transform: translateY(294%); }
}

@keyframes grid-glow {
  0%, 100% { opacity: .25; }
  50% { opacity: .55; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

@keyframes pulse-ring {
  from { transform: scale(.7); opacity: .9; }
  to { transform: scale(1.55); opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px) scale(.98); }
}

/* 用户在系统里选了“减少动态效果”：动画基本停掉 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
  .fx-scan,
  .fx-orbit { display: none; }
}
