/* Bubbleagent 全局样式 · 小清新主题 */
:root {
  --bg: #f4faf7;
  --bg-card: #ffffff;
  --bg-soft: #f1f9f5;
  --border: #dfece6;
  --border-strong: #cfe3da;
  --text: #22343c;
  --muted: #7b919b;
  --primary: #10b981;
  --primary-hover: #0da271;
  --primary-deep: #0b8f66;
  --ok: #10b981;
  --err: #ef4444;
  --warn: #f59e0b;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 74, 58, .05), 0 4px 14px rgba(16, 74, 58, .06);
  --shadow-md: 0 8px 22px rgba(16, 74, 58, .12);
}

* { box-sizing: border-box; }

/* 确保 hidden 属性在所有元素上生效（覆盖 .btn/.chip 等的 display 设置） */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #e7f6ef 0%, #f4faf7 320px, #f9fcfb 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 20px 6px;
  gap: 12px;
}
.brand { font-size: 19px; font-weight: 800; letter-spacing: .3px; display: inline-flex; align-items: center; }
a.brand { text-decoration: none; color: inherit; transition: color .18s ease; }
a.brand:hover { color: var(--primary); }
.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6ee7b7, #10b981);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .14);
  margin-right: 10px;
  flex-shrink: 0;
}
.brand .sub { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

main { max-width: 980px; margin: 0 auto; padding: 10px 20px 60px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 14px; font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(180deg, #6ee7b7, #10b981);
  flex-shrink: 0;
}

.muted { color: var(--muted); font-size: 13px; }
.small-text { font-size: 12px; }

/* ---------- 输入控件 ---------- */
.input, .textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input:hover, .textarea:hover { border-color: #b9d9cc; }
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, .14); }
.input::placeholder, .textarea::placeholder { color: #a4b8b0; }
.row > .input:not(.number-input) { flex: 1 1 0; width: auto; min-width: 0; }
.row > .number-input { flex: 0 0 auto; width: 110px; max-width: 110px; }
.textarea { resize: vertical; line-height: 1.7; }
.small-input { max-width: 160px; }
.aspect-select { max-width: 240px; cursor: pointer; }

.label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- 按钮（含按键特效） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease,
              border-color .18s ease, color .18s ease;
}
.btn:hover {
  border-color: #b9d9cc;
  background: var(--bg-soft);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(16, 74, 58, .1);
}
.btn:active { transform: translateY(0) scale(.96); box-shadow: none; }
.btn.primary {
  background: linear-gradient(135deg, #34d399, #10b981);
  border-color: #0d9e70;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(16, 185, 129, .28);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #2bc48a, #0da271);
  border-color: #0b8f66;
  box-shadow: 0 7px 18px rgba(16, 185, 129, .38);
}
.btn.primary:active { box-shadow: 0 2px 6px rgba(16, 185, 129, .3); }
/* 撤销排队等危险操作按钮 */
.btn.danger {
  color: #dc2626;
  border-color: #f5c2c2;
  background: #fff7f7;
}
.btn.danger:hover {
  background: #fdecec;
  border-color: #ef9a9a;
  box-shadow: 0 5px 14px rgba(220, 38, 38, .12);
}
.btn.big { padding: 13px 34px; font-size: 15px; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.small-btn { padding: 6px 14px; font-size: 12.5px; border-radius: 9px; }

/* ---------- 分段选择 ---------- */
.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.seg-item {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 18px;
  font-size: 13px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  transition: background .18s ease, color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.seg.small .seg-item { padding: 6px 14px; }
.seg-item:hover:not(:disabled):not(.active) { background: rgba(16, 185, 129, .08); color: var(--primary-deep); }
.seg-item:active:not(:disabled) { transform: scale(.95); }
.seg-item.active {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(16, 185, 129, .3);
}
.seg-item:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 上传区（即将上线） ---------- */
.upload-zone {
  margin-top: 14px;
  border: 1px dashed #bfe0d2;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  background: #f8fdfa;
}
.upload-zone.disabled { opacity: .6; }
.upload-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }

/* ---------- 负向提示词 ---------- */
.negative { margin-top: 12px; }
.negative summary { cursor: pointer; color: var(--muted); font-size: 13px; user-select: none; transition: color .18s ease; }
.negative summary:hover { color: var(--primary-deep); }
.negative textarea { margin-top: 8px; }

/* ---------- 参数区 ---------- */
.options { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 16px; }
.options .opt .label { margin-top: 0; }
.submit-row { margin-top: 22px; }

/* ---------- 徽章 / 状态 ---------- */
.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 99px;
  background: #eef7f2;
  border: 1px solid #d8ebe1;
  color: #4d6e60;
}
.chip.wait { color: #b46a09; background: #fdf5e6; border-color: #f3ddb5; }
.chip.ok { color: #0c8c60; background: #e8f9f1; border-color: #c6eeda; }
.chip.err { color: #d13c3c; background: #fdeeee; border-color: #f7d2d2; }

/* ---------- 任务进度 ---------- */
.task-line { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.task-line .right { margin-left: auto; font-variant-numeric: tabular-nums; }
.progress {
  height: 10px;
  background: #eef5f1;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-inner {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #6ee7b7, #10b981);
  box-shadow: 0 0 8px rgba(16, 185, 129, .45);
  transition: width .5s ease;
}

/* ---------- 模型忙碌提示（全局单任务） ---------- */
.busy-banner {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 2px 0 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff4ec, #ffe9e2);
  border: 1px solid #ffb98a;
  color: #c2410c;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(234, 88, 12, .12);
}
.busy-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.busy-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f97316;
  animation: busy-pulse 1.6s ease-out infinite;
  flex-shrink: 0;
}
@keyframes busy-pulse {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .5); }
  70% { box-shadow: 0 0 0 9px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}
.busy-sub { font-size: 12px; font-weight: 400; color: #d97757; }
.busy-track {
  width: 130px;
  height: 8px;
  border-radius: 99px;
  background: rgba(249, 115, 22, .18);
  overflow: hidden;
  flex-shrink: 0;
}
.busy-track-inner {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #fdba74, #f97316);
  transition: width .5s ease;
}
.busy-pct { font-variant-numeric: tabular-nums; min-width: 44px; }

/* ---------- 提示信息 ---------- */
.msg { font-size: 13px; margin: 10px 0 0; }
.msg.error { color: var(--err); }
.msg.ok { color: var(--ok); }

/* ---------- 视频 ---------- */
.video {
  width: 100%;
  border-radius: 14px;
  background: #0f1720;
  margin-bottom: 12px;
  max-height: 480px;
  box-shadow: 0 6px 20px rgba(16, 74, 58, .16);
}

/* ---------- 历史记录 ---------- */
.history { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fbfefd;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.history-item:hover { border-color: #bfe0d2; background: #fff; box-shadow: 0 4px 12px rgba(16, 74, 58, .07); }
.history-item .h-prompt {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.history-item .h-time { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- 窄屏适配（手机 / 小窗口） ---------- */
@media (max-width: 640px) {
  .topbar { padding: 14px 14px 4px; }
  .brand { font-size: 17px; }
  .brand .sub { display: none; }
  .top-right { gap: 8px; }
  main { padding: 8px 12px 48px; }
  .card { padding: 16px 14px; margin-top: 14px; border-radius: 16px; }

  .row { flex-wrap: wrap; }
  .options { flex-direction: column; gap: 16px; }
  .options .opt { width: 100%; }
  .options .opt .input { max-width: 100%; }
  .aspect-select, .small-input { max-width: 100%; }

  .submit-row .btn.big { width: 100%; }
  .input, .textarea { font-size: 16px; }
  .btn { padding: 10px 16px; }

  .task-line { flex-wrap: wrap; gap: 8px; }
  .history-item { flex-wrap: wrap; }
  .history-item .h-prompt { flex: 1 1 100%; order: 9; white-space: normal; }
}
