/* MiniMax H3 视频工作台 — 月兔 · 樱花粉 / 冰蓝 / 奶白 */

:root {
  --bg: #faf7fa;
  --bg-soft: #fcfafc;
  --panel: #fffdfd;
  --panel-2: #eef5fa;
  --line: #ded5df;
  --line-soft: #ece3eb;
  --text: #443b4b;
  --muted: #716579;
  --faint: #7c6f82;
  --accent: #a44870;
  --accent-2: #bc6085;
  --accent-soft: rgba(218, 137, 169, .15);
  --ok: #28755e;
  --warn: #88631b;
  --danger: #b04457;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(102, 73, 96, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(239, 185, 205, .30), transparent 70%),
    radial-gradient(700px 380px at 92% 0%, rgba(174, 211, 233, .32), transparent 70%);
  z-index: 0;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
em { font-style: normal; color: var(--faint); font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 252, 254, .90);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 6px 18px rgba(185, 103, 141, .18);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: .01em; }
.brand-text small { color: var(--faint); font-size: 11.5px; font-family: var(--mono); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.field-inline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.field-inline select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 12.5px;
  max-width: 210px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}
.pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.pill.ok { color: var(--ok); border-color: rgba(52, 211, 153, .35); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 8px rgba(52, 211, 153, .7); }
.pill.bad { color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.pill.bad::before { background: var(--danger); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { background: #f8eaf1; border-color: #cfaebf; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(185, 103, 141, .20);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.block { width: 100%; }
.btn.big { padding: 12px 16px; font-size: 15px; margin-top: 4px; }
.btn.mini { padding: 4px 9px; font-size: 11.5px; border-radius: 8px; }
.btn.ghost.danger-text:hover {
  color: var(--danger);
  border-color: rgba(248, 113, 113, .35);
  background: rgba(248, 113, 113, .1);
}
.btn.dashed {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  padding: 10px;
}
.btn.dashed:hover { color: var(--text); border-color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.danger { color: var(--danger); border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .08); }
.btn.danger:hover { background: rgba(248, 113, 113, .16); }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline dotted;
}
.link:hover { color: var(--text); }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 布局 ---------- */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
}

.composer {
  position: sticky;
  top: 78px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.panel-block { margin-bottom: 16px; }
.panel-block:last-of-type { margin-bottom: 8px; }

.label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #65536c;
  letter-spacing: .02em;
  margin-bottom: 7px;
}
.label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.label-row .label { margin-bottom: 0; }

input[type="text"], input[type="number"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 104px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--faint); }

.hint-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* 分段控件 */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: linear-gradient(135deg, #f7d7e4, #e6f0f8);
  color: #79435f;
  font-weight: 600;
}
.ratio {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: .85;
}
.ratio.r16-9 { width: 16px; height: 9px; }
.ratio.r9-16 { width: 9px; height: 16px; }

/* 时长滑块 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 33%), #ddebf3 var(--fill, 33%));
  outline: none;
  padding: 0;
  border: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(123, 87, 112, .18);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
}
.scale { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; margin-top: 5px; }
.duration-out { font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 600; }

/* 上传 */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 16px 12px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--muted);
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus, .dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dz-main { font-size: 13px; }
.dz-sub { font-size: 11.5px; color: var(--faint); }

.thumb-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.thumb-strip:empty { display: none; }

.thumb-item {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  aspect-ratio: 1;
}
.thumb-item img, .thumb-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-item .audio-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--muted);
  font-size: 10.5px;
  padding: 4px;
  text-align: center;
}
.thumb-item .audio-face span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.thumb-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 19px; height: 19px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 10, 15, .78);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.thumb-item:hover .thumb-remove { opacity: 1; }

.advanced summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 0;
}
.advanced summary:hover { color: var(--text); }
.advanced[open] summary { margin-bottom: 6px; }

/* ---------- 画廊 ---------- */
.gallery { min-width: 0; }

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: #b9a8bb; }
.chip.active { background: var(--accent-soft); border-color: #d7a0b9; color: #914364; font-weight: 600; }
.gallery-meta { display: flex; gap: 14px; align-items: center; }

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

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s, border-color .16s, box-shadow .16s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #d7a0b9;
  box-shadow: 0 16px 34px rgba(102, 73, 96, .14);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #eef3f8;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card-media img, .card-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-media.cover img { object-fit: cover; }

.empty-thumb {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  opacity: .4;
  color: var(--faint);
}
.empty-thumb.gen { opacity: 1; }

.card-badges {
  position: absolute;
  top: 9px;
  left: 9px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  z-index: 2;
}
.badge {
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-family: var(--mono);
  background: rgba(8, 10, 15, .74);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(6px);
  color: #d7dcec;
}
.badge.status { font-family: var(--font); font-weight: 600; }
.badge.status.running { color: #ffe09a; border-color: rgba(251, 191, 36, .42); }
.badge.status.succeeded { color: #a4e1ce; border-color: rgba(52, 211, 153, .42); }
.badge.status.failed, .badge.status.violation { color: #ffb5c5; border-color: rgba(248, 113, 113, .42); }

.card-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 12, .34);
  opacity: 0;
  transition: opacity .18s;
  z-index: 2;
}
.card:hover .card-play { opacity: 1; }
.card-play i {
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .93);
  color: #14161d;
  font-style: normal;
  font-size: 20px;
  padding-left: 3px;
  box-shadow: 0 8px 22px rgba(102, 73, 96, .10);
}

/* 进度 */
.card-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 10px 12px 12px;
  background: linear-gradient(to top, rgba(6, 8, 12, .95), rgba(6, 8, 12, .6) 60%, transparent);
}
.progress-line {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  overflow: hidden;
  position: relative;
}
.progress-line i {
  display: block;
  height: 100%;
  border-radius: 999px;
  /* 流动渐变：让等待有"在动"的反馈 */
  background: linear-gradient(90deg,
    var(--accent) 0%, var(--accent-2) 25%, #58c8ff 50%, var(--accent-2) 75%, var(--accent) 100%);
  background-size: 300% 100%;
  animation: flowbar 2.4s linear infinite;
  transition: width .6s ease;
  min-width: 8px;
}
@keyframes flowbar { to { background-position: -300% 0; } }

.progress-text {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
  margin-bottom: 6px;
  color: #d5dbeb;
}
.progress-text b { color: #fff; font-weight: 600; }
.progress-text .waited, .waited { font-family: var(--mono); color: #a8b0c6; }

.waited { font-size: 11.5px; }

.phase {
  margin-top: 6px;
  font-size: 10.5px;
  color: #9aa3ba;
  letter-spacing: .02em;
  animation: phasefade .6s ease;
}
@keyframes phasefade { from { opacity: 0; transform: translateY(2px); } }

.progress-line.indeterminate i {
  width: 38% !important;
  animation: flowbar 2.4s linear infinite, slide 1.6s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* 生成中：画面区呼吸光效 + 扫光 */
.card-media.generating::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(115deg,
    transparent 32%, rgba(255, 255, 255, .09) 50%, transparent 68%);
  background-size: 250% 100%;
  animation: sweep 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sweep {
  0% { background-position: 160% 0; }
  100% { background-position: -160% 0; }
}

.gen-icon {
  position: relative;
  z-index: 2;
  font-size: 27px;
  animation: genpulse 1.9s ease-in-out infinite;
}
@keyframes genpulse {
  0%, 100% { transform: scale(1); opacity: .45; }
  50% { transform: scale(1.14); opacity: .9; }
}

/* 生成耗时标签 */
.tag.time { color: var(--ok); border-color: rgba(52, 211, 153, .25); }

.card-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 8px; }
.card-prompt {
  font-size: 13px;
  line-height: 1.5;
  color: #514556;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 39px;
}
.card-prompt.placeholder { color: var(--faint); font-style: italic; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.card-act { display: flex; gap: 5px; flex-shrink: 0; }
.tag {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
}
.card-time { font-size: 11.5px; color: var(--faint); white-space: nowrap; }

.card-error {
  font-size: 12px;
  color: var(--danger);
  background: rgba(248, 113, 113, .08);
  border: 1px solid rgba(248, 113, 113, .22);
  border-radius: 8px;
  padding: 6px 9px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-actions {
  display: flex;
  gap: 6px;
}
.card-actions .btn { padding: 6px 10px; font-size: 12px; flex: 1; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 90px 20px;
  color: var(--muted);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 253, .72);
}
.empty-icon { font-size: 34px; opacity: .8; }

/* ---------- 预览层 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 7, 11, .93);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 28px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.lb-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 22px;
  width: min(1420px, 100%);
  max-height: 100%;
}
.lb-stage {
  display: grid;
  place-items: center;
  background: #06070b;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 300px;
}
.lb-stage video, .lb-stage img {
  max-width: 100%;
  max-height: calc(100vh - 96px);
  display: block;
  background: #06070b;
}
.lb-note {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
  width: 100%;
  text-align: center;
}

.lb-side {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  overflow-y: auto;
  max-height: calc(100vh - 96px);
}
.lb-side h3 { margin: 0 0 10px; font-size: 13px; color: #65536c; letter-spacing: .02em; }
.lb-prompt {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 16px;
}
.lb-meta { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 12.5px; margin-bottom: 16px; }
.lb-meta dt { color: var(--faint); }
.lb-meta dd { margin: 0; font-family: var(--mono); color: #514556; word-break: break-all; }
.lb-actions { display: flex; flex-direction: column; gap: 9px; }
.lb-actions .row { display: flex; gap: 9px; }
.lb-actions .row .btn { flex: 1; }
.lb-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; margin-bottom: 14px; }
.lb-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); cursor: pointer; }
.lb-thumbs img.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.lb-src { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

.lb-close {
  position: absolute;
  top: 16px; right: 18px;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 21px;
  line-height: 1;
  z-index: 3;
}
.lb-close:hover { background: var(--panel-2); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 253, 253, .95);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  z-index: 3;
}
.lb-nav:hover { background: var(--panel-2); }
.lb-nav.prev { left: 18px; }
.lb-nav.next { right: 18px; }

/* ---------- 登录 ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.gate-card {
  width: min(360px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
  text-align: center;
  box-shadow: var(--shadow);
}
.gate-logo {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 10px 26px rgba(185, 103, 141, .18);
}
.gate-card h1 { margin: 0 0 4px; font-size: 18px; }
.gate-card p { margin: 0 0 18px; font-size: 12.5px; }
.gate-card input { margin-bottom: 12px; text-align: center; }
.gate-error { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; }

/* ---------- 提示 ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(400px, calc(100vw - 40px));
}
.toast {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: rise .2s ease;
  word-break: break-word;
}
.toast.ok { border-color: rgba(52, 211, 153, .4); }
.toast.err { border-color: rgba(248, 113, 113, .45); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .composer { position: static; max-height: none; }
  .lb-body { grid-template-columns: 1fr; }
  .lb-side { max-height: 42vh; }
  .lb-nav { display: none; }
}
@media (max-width: 620px) {
  .topbar { padding: 10px 14px; }
  .brand-text { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 11px; }
  .card-prompt { -webkit-line-clamp: 3; }
  .lightbox { padding: 12px; }
}

/* Character details stay inside existing components; layout dimensions are unchanged. */
:root { color-scheme: light; --ice: #d6eaf6; --gold: #d7b867; }
.brand-mark, .gate-logo {
  position: relative;
  color: #79435f;
  background: linear-gradient(145deg, #f5c4d7, #e0eef8);
  border: 1px solid #e0bbcc;
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 6px;
  height: 12px;
  border: 1px solid #deb7c9;
  border-radius: 70% 70% 40% 40%;
  background: linear-gradient(#fffdfd, #f5c4d7);
  pointer-events: none;
}
.brand-mark::before { left: 10px; transform: rotate(-16deg); }
.brand-mark::after { right: 10px; transform: rotate(16deg); }
.composer { background: linear-gradient(160deg, #fffdfd, #fff9fc 65%, #f5faff); }
.btn.primary { border-color: #ac5077; }
.btn.primary:hover { filter: brightness(.96); }
.segmented button.active { box-shadow: inset 0 0 0 1px #e4b9cd, 0 2px 5px rgba(117, 86, 112, .07); }
.dropzone { background: linear-gradient(125deg, #f9f1f6, #f0f7fc); border-color: #b8cddd; }
.btn.dashed { border-color: #b8cddd; background: #f5faff; }
.chip.active { background: #f7e2ec; box-shadow: 0 2px 6px rgba(170, 104, 139, .08); }
.card { box-shadow: 0 4px 14px rgba(102, 73, 96, .04); }
.empty-icon { color: #ab7494; opacity: 1; }
.empty-icon svg { display: block; width: 48px; height: 48px; }
.lightbox { background: rgba(49, 42, 57, .88); }
.lb-stage, .lb-stage video, .lb-stage img { background: #25232c; }
.lb-stage .muted { color: #d6cddc; }
.lb-stage .btn { color: var(--text); }
.pill.ok { background: #eff8f4; border-color: #b9dccd; }
.pill.ok::before { box-shadow: 0 0 6px rgba(40, 117, 94, .2); }
.pill.bad { background: #fff0f3; border-color: #e6bcc6; }
.card-error, .btn.danger { background: #fff0f3; border-color: #e6bcc6; }
.toast.ok { border-color: #9bc9b6; }
.toast.err { border-color: #d999ad; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.composer, .lb-side { scrollbar-width: thin; scrollbar-color: #d6becf transparent; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* AI-generated moon-bunny mascot and decorative alpha artwork. */
body::after {
  content: "";
  position: fixed;
  inset: 65px 0 0;
  z-index: 0;
  pointer-events: none;
  background: url("/static/assets/moon-carrot-background.png") center / cover no-repeat;
  opacity: .42;
}
.brand-mark, .gate-logo {
  background: none;
  border: 0;
  box-shadow: none;
}
.brand-mark::before, .brand-mark::after { content: none; }
.brand-mark img, .gate-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
input[type="range"]::-webkit-slider-thumb {
  width: 30px;
  height: 30px;
  background: var(--mascot-current) center / contain no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 2px 2px rgba(100, 65, 90, .20));
}
input[type="range"]::-moz-range-thumb {
  width: 30px;
  height: 30px;
  background: var(--mascot-current) center / contain no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 2px 2px rgba(100, 65, 90, .20));
}
.progress-line { overflow: visible; }
.progress-line i { position: relative; }
.progress-line i::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  background: var(--mascot-current) center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .20));
  pointer-events: none;
}
.progress-line.indeterminate i {
  animation: flowbar 2.4s linear infinite, mascot-slide 1.6s ease-in-out infinite alternate;
}
@keyframes mascot-slide { from { transform: translateX(0); } to { transform: translateX(163%); } }
/* Pale decorations inside the existing empty area stay behind its content. */
.empty {
  background: rgba(255, 253, 253, .36);
}
.lb-stage .progress-line { color: #fff; }
.lb-stage .gen-icon + div { color: #f3edf5; }
@media (prefers-reduced-motion: reduce) { .progress-line.indeterminate i { animation: none; } }

.card-progress { background: linear-gradient(to top, rgba(49, 42, 57, .96), rgba(49, 42, 57, .84) 60%, rgba(49, 42, 57, .66)); }

/* Logo remains the same size while acting as a keyboard-accessible trigger. */
button.brand-mark { padding: 0; flex-shrink: 0; user-select: none; }

/* Unified Quick Look-style preview window. */
.lightbox {
  padding: 32px;
  background: rgba(32, 27, 39, .52);
  backdrop-filter: blur(20px) saturate(.85);
  -webkit-backdrop-filter: blur(20px) saturate(.85);
}
.lb-body {
  grid-template-columns: minmax(0, 1fr) 326px;
  grid-template-rows: 52px minmax(0, 1fr);
  gap: 0;
  width: min(1260px, 100%);
  height: min(760px, calc(100dvh - 64px));
  max-height: calc(100dvh - 64px);
  background: #faf8fb;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 28px 100px rgba(26, 16, 32, .28), 0 3px 12px rgba(26, 16, 32, .12);
}
.lb-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: linear-gradient(#fcfafc, #f2eef4);
  border-bottom: 1px solid #e5dfe8;
}
.lb-window-title { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 0; }
.lb-window-title strong { font-size: 13px; font-weight: 600; color: #534957; }
#lb-position { font: 11px var(--mono); color: #8d8194; }
.lb-navigation { display: flex; gap: 4px; }
.lb-close, .lb-nav {
  position: static;
  transform: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #786b80;
  padding: 6px;
  transition: background .15s, color .15s;
}
.lb-close { width: 24px; height: 24px; border-radius: 50%; padding: 5px; background: #e6dfe9; }
.lb-close:hover { background: #edd0dc; color: #924565; }
.lb-nav:hover { background: #e9e2ec; color: #534957; }
.lb-nav:disabled { opacity: .3; cursor: default; background: transparent; }
.lb-close svg, .lb-nav svg, .lb-action-icon { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb-stage {
  min-height: 0;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: #1c1b21;
  display: flex;
  flex-direction: column;
}
.lb-stage video, .lb-stage img {
  flex: 1;
  width: 100%;
  height: 0;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  background: #1c1b21;
}
.lb-stage > div:not(.lb-note) { margin: auto; max-width: 100%; }
.lb-stage .progress-line { max-width: min(300px, 60vw); }
.lb-stage > div { color: #e7dfe9; }
.lb-note {
  flex-shrink: 0;
  font-size: 11px;
  color: #a99eaf;
  background: #232128;
  border: 0;
  padding: 10px 16px;
  text-align: left;
}
.lb-side {
  border: 0;
  border-left: 1px solid #e8e0e9;
  border-radius: 0;
  background: #fffdfd;
  padding: 22px;
  max-height: none;
  display: flex;
  flex-direction: column;
}
.lb-inspector-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.lb-inspector-title h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.lb-status { border-radius: 6px; padding: 3px 7px; font-size: 10.5px; color: #776c7e; background: #f1edf3; white-space: nowrap; }
.lb-status.succeeded { color: #427b68; background: #edf6f1; }
.lb-status.running, .lb-status.queued { color: #917034; background: #faf3e4; }
.lb-status.failed, .lb-status.violation { color: #b04457; background: #fbedf0; }
.lb-side h3 { font-size: 11px; color: #98869c; font-weight: 500; margin-bottom: 8px; }
.lb-prompt { border: 0; background: none; border-radius: 0; padding: 0; line-height: 1.8; font-size: 13px; margin-bottom: 24px; flex-shrink: 0; }
.lb-meta { gap: 0 12px; font-size: 12px; margin: 0 0 16px; }
.lb-meta dt, .lb-meta dd { padding: 9px 0; border-bottom: 1px solid #f0eaf1; line-height: 1.6; }
.lb-meta dt { color: #948699; }
.lb-meta dd { text-align: right; font-family: var(--font); font-weight: 500; color: #5d4e63; }
.lb-details { margin-bottom: 12px; flex-shrink: 0; }
.lb-details summary { color: #95839c; font-size: 11px; cursor: pointer; padding: 5px 0; }
.lb-details .lb-meta { margin: 6px 0 0; }
.lb-details dd { font-size: 11px; font-weight: 400; }
.lb-actions { margin-top: auto; padding-top: 14px; gap: 9px; flex-shrink: 0; }
.lb-actions .btn { min-height: 36px; padding: 8px 10px; border-radius: 9px; font-size: 12px; text-decoration: none; box-shadow: none; }
.lb-actions .btn.primary { background: #b15c83; border-color: #ac537b; color: #fff; font-weight: 500; }
.lb-actions .row .btn { background: #f7f3f8; border-color: #eee6f0; font-size: 11px; white-space: nowrap; }
.lb-actions .btn.ghost, .lb-actions .btn.danger { border: 0; background: transparent; min-height: 28px; padding: 5px 8px; font-size: 11px; }
.lb-actions .btn.ghost:hover { background: #f7f3f8; }
.lb-actions .btn.danger { color: #ac6c7e; }
.lb-actions .btn.danger:hover { background: #fff0f3; color: #b04457; }
.lb-action-icon { width: 14px; height: 14px; flex-shrink: 0; }
@media (max-width: 860px) {
  .lightbox { padding: 16px; }
  .lb-body { grid-template-columns: 1fr; grid-template-rows: 48px minmax(180px, 1fr) minmax(0, auto); height: calc(100dvh - 32px); max-height: calc(100dvh - 32px); border-radius: 16px; }
  .lb-side { max-height: 38dvh; border-left: 0; border-top: 1px solid #e8e0e9; padding: 18px 20px; }
  .lb-nav { display: grid; }
  .lb-inspector-title { margin-bottom: 18px; }
}

/* ==================== 工作台切换（视频 / 图片） ==================== */
.workbench-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin-left: 8px;
  margin-right: auto;
  border-radius: 999px;
  background: #f2ecf2;
  border: 1px solid #e6dde7;
  box-shadow: inset 0 1px 2px rgba(102, 73, 96, .06);
}
.workbench-switch button {
  border: 0;
  background: transparent;
  color: #7a6c80;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 999px;
  line-height: 1.2;
  transition: background .18s, color .18s, box-shadow .18s;
}
.workbench-switch button:hover { color: #4b3f52; }
.workbench-switch button.active {
  background: linear-gradient(135deg, #b15c83, #a44870);
  color: #fff;
  box-shadow: 0 2px 8px rgba(164, 72, 112, .26);
}
.workbench-switch button:focus-visible {
  outline: 2px solid #b15c83;
  outline-offset: 1px;
}

/* 图片模式的参数面板沿用现有卡片样式，仅细化下拉与说明 */
#params-image select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 13px;
}
#image-size-note, #image-ratio-note, #image-model-note { margin-top: 6px; }

@media (max-width: 620px) {
  .workbench-switch { margin-left: 4px; }
  .workbench-switch button { padding: 6px 11px; font-size: 12px; }
}

/* Each workbench and historical task uses its own matching mascot. */
:root {
  --mascot-camera: url("/static/assets/moon-bunny-camera-v2.png");
  --mascot-artist: url("/static/assets/moon-bunny-artist-v3.png");
  --mascot-current: var(--mascot-camera);
}
[data-mascot-mode="video"] { --mascot-current: var(--mascot-camera); }
[data-mascot-mode="image"] { --mascot-current: var(--mascot-artist); }

/* Larger visual footprint preserves the existing logo button layout. */
.brand-mark img { transform: scale(1.25); }
