
/* ============================================================
   宝艺莱珠宝AI工具 — 深色科技风 (Dark Tech)
   配色: GitHub Dark + 青蓝主色 (#58A6FF)
   注: --gold-* 变量名保留(映射为青蓝), 兼容 JS 动态生成内容
   ============================================================ */

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* 主色 青蓝 (保留 --gold-* 名称以兼容 JS) */
  --gold-light: #58A6FF;   /* 主色亮 - 高亮/激活 */
  --gold: #3B82F6;          /* 主色 */
  --gold-core: #2F81F7;     /* 主色中 */
  --gold-deep: #1F6FEB;     /* 主色深 */
  --gold-dark: #1158C7;     /* 主色暗 */
  --gold-glow: rgba(88,166,255,0.40);
  /* 暖色强调 (HOT/警告, 保持识别度) */
  --orange: #FF7B39;
  --orange-soft: #FFA75A;
  --orange-deep: #E55934;
  /* 背景 */
  --bg-main: #0D1117;       /* 主背景 */
  --bg-card: #161B22;       /* 次背景 */
  --bg-elevated: #21262D;   /* 卡片背景 */
  --bg-input: #21262D;      /* 输入框背景 */
  /* 边框 */
  --border-dim: #30363D;
  --border-mid: #3D444D;
  /* 文字 */
  --text-main: #F0F6FC;     /* 主文字 */
  --text-soft: #E6EDF3;     /* 次亮文字 */
  --text-muted: #8B949E;    /* 次文字 */
  --text-dim: #6E7681;      /* 弱文字 */
  /* 强调 */
  --wine: #F85149;          /* 危险/删除 */
  --apricot: #58A6FF;
  --apricot-deep: #1F6FEB;
  --apricot-dark: #1158C7;
  --green-dot: #3FB950;     /* 成功 */
  /* 圆角 */
  --radius: 12px;           /* 卡片 */
  --radius-md: 12px;
  --radius-sm: 8px;         /* 小元素 */
  --radius-full: 999px;     /* pill 按钮 */
  /* 字体 */
  --font: -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
html { font-size: 16px; }
body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}
/* 科技网格光晕纹理 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(88,166,255,0.06) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(59,130,246,0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(88,166,255,0.03) 0%, transparent 30%);
}
body > * { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

/* ===== 细滚动条 (4px 深色) ===== */
* { scrollbar-width: thin; scrollbar-color: #30363D transparent; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #30363D; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #58A6FF; }

/* ===== 自定义标题栏 ===== */
.custom-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-dim);
  -webkit-app-region: drag;
  user-select: none;
  position: relative;
  z-index: 99999;
  flex-shrink: 0;
}
.titlebar-drag-region {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 100%;
  flex: 1;
  -webkit-app-region: drag;
}
.titlebar-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
}
.titlebar-title {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
  letter-spacing: 0.5px;
}
.titlebar-controls {
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
}
.titlebar-btn {
  width: 46px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.titlebar-btn:hover {
  background: rgba(88,166,255,0.12);
  color: var(--gold-light);
}
.titlebar-btn:active {
  background: rgba(88,166,255,0.20);
}
.titlebar-close:hover {
  background: #e81123;
  color: #fff;
}
.titlebar-close:active {
  background: #c50f1f;
}

/* ===== 启动加载动画 ===== */
.splash-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 40%, #161B22 0%, #0D1117 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  transition: opacity 0.5s ease;
}
.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.splash-logo {
  margin-bottom: 32px;
}
.splash-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 4px 16px rgba(88,166,255,0.45));
}
.splash-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(88,166,255,0.15);
  border-top-color: var(--gold-light);
  border-radius: 50%;
  animation: splash-spin 0.8s linear infinite;
  margin-bottom: 16px;
  box-shadow: 0 0 16px rgba(88,166,255,0.25);
}
@keyframes splash-spin {
  to { transform: rotate(360deg); }
}
.splash-text {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 1px;
}

/* ===== 登录页 ===== */
.login-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 35%, #161B22 0%, #0D1117 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
}
.login-overlay.hidden {
  display: none;
}
.login-box {
  background: rgba(33,38,45,0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(88,166,255,0.18);
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(88,166,255,0.05);
}
.login-logo {
  position: relative;
  display: inline-block;
  margin-bottom: 4px;
}
.login-logo img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 4px 16px rgba(88,166,255,0.4));
  animation: logoGlow 2s ease-in-out infinite alternate;
}
@keyframes logoGlow {
  0% {
    filter: drop-shadow(0 0 6px rgba(88,166,255,0.4)) drop-shadow(0 0 12px rgba(88,166,255,0.2));
  }
  100% {
    filter: drop-shadow(0 0 14px rgba(88,166,255,0.8)) drop-shadow(0 0 28px rgba(88,166,255,0.5)) drop-shadow(0 0 48px rgba(59,130,246,0.3));
  }
}
@media (prefers-reduced-motion: reduce) {
  .login-logo img { animation: none; }
}
.login-title {
  color: var(--text-main);
  font-size: 22px;
  font-weight: 600;
  margin: 16px 0 4px;
  letter-spacing: 1px;
}
.login-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 28px;
}
.login-field {
  margin-bottom: 14px;
}
.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input::placeholder {
  color: var(--text-dim);
}
.login-field input:focus {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.login-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}
.login-btn:hover { box-shadow: 0 6px 22px var(--gold-glow); transform: translateY(-1px); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-tip {
  color: var(--wine);
  font-size: 13px;
  min-height: 18px;
  margin: 10px 0 0;
}
.login-hint {
  color: var(--text-dim);
  font-size: 12px;
  margin: 16px 0 0;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-dim);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.3);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-wrap {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(88,166,255,0.15), rgba(31,111,235,0.08));
  border: 1px solid rgba(88,166,255,0.30);
  overflow: hidden;
  position: relative;
}
.logo-wrap img {
  width: 32px; height: 32px; object-fit: contain; border-radius: 4px;
  animation: logo-shimmer 3s ease-in-out infinite;
}
@keyframes logo-shimmer {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 0 transparent); }
  50% { filter: brightness(1.3) drop-shadow(0 0 6px rgba(88,166,255,0.7)); }
}
.logo-wrap::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
  animation: logo-sweep 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes logo-sweep {
  0% { transform: translateX(-150%) rotate(0deg); }
  100% { transform: translateX(150%) rotate(0deg); }
}
.brand-name { font-size: 15px; font-weight: 600; color: var(--text-main); white-space: nowrap; }
.brand-sub {
  font-size: 11px; color: var(--gold-light); padding: 2px 8px;
  background: rgba(88,166,255,0.10);
  border: 1px solid rgba(88,166,255,0.30);
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* Nav tabs */
.nav-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-tab {
  padding: 8px 16px; font-size: 13px; color: var(--text-muted);
  border-radius: var(--radius-sm); transition: all .15s; white-space: nowrap;
  position: relative; font-weight: 500;
}
.nav-tab:hover { background: var(--bg-elevated); color: var(--text-main); }
.nav-tab.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 12px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative; overflow: hidden;
}
.nav-tab.active::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
  animation: quantum-sweep 3s ease-in-out infinite;
}
@keyframes quantum-sweep {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.nav-caret { font-size: 10px; opacity: 0.6; margin-left: 2px; }

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 0;
  min-width: 180px; z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  padding: 6px;
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: all .2s;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.nav-drop-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.nav-drop-item:hover { background: rgba(88,166,255,0.10); color: var(--text-main); }
.nav-drop-item.active {
  background: linear-gradient(135deg, rgba(88,166,255,0.20), rgba(31,111,235,0.08));
  color: var(--gold-light); font-weight: 600;
}
.nav-drop-item .hot,
.nav-tab .hot {
  font-size: 9px; padding: 1px 5px; border-radius: 8px;
  background: var(--orange); color: #fff; margin-left: 6px;
  font-weight: 600;
}
.nav-tab.active .hot {
  background: #fff; color: var(--orange-deep);
}

.top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.my-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; color: var(--text-main);
  background: var(--bg-elevated); border-radius: var(--radius-full);
  border: 1px solid var(--border-dim); transition: all .15s;
}
.my-btn:hover {
  border-color: var(--gold-light);
  background: rgba(88,166,255,0.10);
  color: var(--gold-light);
  box-shadow: 0 0 12px rgba(88,166,255,0.25);
}
.avatar-icon { width: 22px; height: 22px; color: var(--gold-light); }

/* ===== Layout (三栏) ===== */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ===== Left sidebar ===== */
.sidebar-left {
  background: var(--bg-card);
  border-right: 1px solid var(--border-dim);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  height: 100%;
}

/* Tool header */
.tool-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-dim);
}
.tool-header-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  box-shadow: 0 2px 10px var(--gold-glow);
}
.tool-header-title { font-size: 14px; font-weight: 700; color: var(--text-main); }
.tool-header-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Tool params */
.tool-params { display: flex; flex-direction: column; gap: 12px; }
.param-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
.param-group:last-child { margin-bottom: 0; }
.param-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--text-soft);
  margin-bottom: 0;
}
.param-sub { font-size: 10px; font-weight: 400; color: var(--text-dim); }
.param-val { font-size: 11px; color: var(--text-muted); }
.required { color: var(--orange); font-size: 11px; }
.char-count { font-size: 10px; color: var(--text-dim); }
.param-input {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-main);
  font-size: 12px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.param-input:focus {
  outline: none; border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.param-input::placeholder { color: var(--text-dim); }
.param-hint { font-size: 10px; color: var(--text-dim); padding: 2px 0; }

/* Chip group */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-elevated); cursor: pointer;
  border: 1px solid var(--border-dim);
  transition: all .15s; user-select: none;
}
.chip:hover { color: var(--text-main); border-color: var(--gold-light); }
.chip:hover:not(.on) { border-color: var(--gold-light); color: var(--gold-light); background: rgba(88,166,255,0.08); }
.chip.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; font-weight: 600;
  box-shadow: 0 0 10px var(--gold-glow);
  border-color: transparent;
}
.chip.on {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; border-color: transparent; font-weight: 500;
  box-shadow: 0 0 10px var(--gold-glow);
}

/* Ratio grid */
.ratio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ratio-btn {
  padding: 6px 0; text-align: center;
  border-radius: var(--radius-sm); font-size: 12px;
  background: var(--bg-elevated); color: var(--text-muted);
  border: 1px solid var(--border-dim); cursor: pointer;
  transition: all .15s;
}
.ratio-btn:hover { color: var(--text-main); border-color: var(--gold-light); }
.ratio-btn:hover:not(.on) { border-color: var(--gold-light); color: var(--gold-light); }
.ratio-btn.active {
  border-color: var(--gold-light); color: var(--gold-light);
  background: rgba(88,166,255,0.12); font-weight: 600;
  box-shadow: 0 0 10px var(--gold-glow);
}
.ratio-btn.on {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; border-color: transparent; font-weight: 500;
  box-shadow: 0 0 10px var(--gold-glow);
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border-mid); border-radius: var(--radius);
  padding: 20px; text-align: center; transition: all .15s;
  background: var(--bg-input); cursor: pointer;
}
.upload-area:hover { border-color: var(--gold-light); background: rgba(88,166,255,0.05); }
.upload-area.dragover { border-color: var(--gold-light); background: rgba(88,166,255,0.10); box-shadow: 0 0 16px var(--gold-glow); }
.upload-area-icon { font-size: 28px; color: var(--gold-light); margin-bottom: 8px; }
.upload-area-text { font-size: 13px; color: var(--text-soft); }
.upload-area-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.upload-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.upload-thumb {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border-dim);
  position: relative; overflow: hidden; cursor: pointer;
}
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb-del {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(248,81,73,0.90); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer; line-height: 1;
}
.upload-thumb-add {
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--text-muted);
  border: 2px dashed var(--border-mid); cursor: pointer;
  background: transparent;
}
.upload-thumb-add:hover { border-color: var(--gold-light); color: var(--gold-light); }
.upload-thumb .remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--wine); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}

/* Mode switch */
.mode-switch-box {
  margin-top: 12px;
}
.mode-switch-tabs {
  display: flex; gap: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border-dim);
}
.mode-tab {
  flex: 1; padding: 9px 8px; border: none; border-radius: 6px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
  background: transparent; font-family: inherit; font-weight: 500;
  transition: all 0.2s;
}
.mode-tab.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.mode-switch-desc {
  font-size: 12px; color: var(--text-muted);
  margin-top: 8px; line-height: 1.5;
}

/* Custom prompt box */
.custom-prompt-box {
  margin-top: 12px; padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
}
.custom-prompt-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.custom-prompt-label span:first-child {
  font-size: 12px; font-weight: 600; color: var(--text-soft);
}
.custom-prompt-hint {
  font-size: 11px; color: var(--text-dim);
}
.custom-prompt-input {
  width: 100%; min-height: 60px; max-height: 120px;
  padding: 10px 12px; border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-main);
  font-size: 13px; font-family: inherit; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.custom-prompt-input:focus {
  outline: none; border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.custom-prompt-input::placeholder { color: var(--text-dim); }

/* Buttons */
.btn {
  padding: 10px 24px; font-size: 13px; border-radius: var(--radius-full);
  font-weight: 500; transition: all .15s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  border: 1px solid var(--gold-core);
  color: #fff; flex: 1;
  box-shadow: 0 3px 14px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.18);
  font-weight: 600;
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
  animation: quantum-sweep 3s ease-in-out infinite;
}
.btn-primary:hover {
  box-shadow: 0 5px 20px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.25);
  transform: translateY(-1px);
}
.btn-ghost {
  background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #fff;
  border: 1px solid var(--gold-core);
  font-weight: 600;
}
.btn-ghost:hover { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); border-color: var(--gold-deep); color: #fff; }

/* Generate button */
.gen-btn {
  width: 100%; font-size: 14px; font-weight: 700;
  padding: 12px; background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  color: #fff; border: 1px solid var(--gold-core); border-radius: var(--radius-full);
  cursor: pointer; transition: all .15s;
  box-shadow: 0 4px 18px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative; overflow: hidden;
}
.gen-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
  animation: quantum-sweep 3s ease-in-out infinite;
}
.gen-btn:hover { box-shadow: 0 6px 24px var(--gold-glow); transform: translateY(-1px); }
.gen-btn:active { transform: translateY(0); }

/* Canvas toolbar (sticky generate row) */
.canvas-toolbar { margin-top: 0; display: flex; gap: 8px; width: 100%; }
.sidebar-left .canvas-toolbar {
  margin-top: auto;
  position: sticky; bottom: 0;
  padding-top: 12px;
  background: var(--bg-card);
}

.sec-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 8px;
}
.tool-cat { font-size: 12px; color: var(--text-dim); margin: 12px 0 4px; padding-left: 4px; font-weight: 500; }
.tool-cat:first-child { margin-top: 0; }
.tool-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted);
  transition: all .15s; user-select: none;
}
.tool-item:hover { background: var(--bg-elevated); color: var(--text-main); }
.tool-item.active {
  background: linear-gradient(135deg, rgba(88,166,255,0.20), rgba(31,111,235,0.08));
  color: var(--gold-light);
  font-weight: 600; box-shadow: inset 3px 0 0 var(--gold-light);
}
.tool-icon { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.tool-hot {
  font-size: 9px; color: #fff; background: var(--orange);
  padding: 1px 5px; border-radius: 3px; margin-left: auto; font-weight: 600;
}

/* ===== Center ===== */
.center-area {
  background: var(--bg-main);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  gap: 10px;
  height: 100%;
}
.center-area > * { max-width: 100%; width: 100%; }

/* ===== Algorithm placeholder - Energy Core (青蓝能量核) ===== */
.algo-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; min-height: 400px; gap: 6px; position: relative;
}

/* Energy core container */
.algo-energy {
  position: relative; width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}

/* Core - 青蓝光球 */
.algo-energy-core {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, rgba(88,166,255,0.45) 30%, rgba(31,111,235,0.20) 70%);
  box-shadow: 0 0 24px rgba(88,166,255,0.45);
  animation: energyCorePulse 2s ease-in-out infinite;
  z-index: 10;
}
@keyframes energyCorePulse {
  0%,100% { transform: translate(-50%,-50%) scale(1); box-shadow: 0 0 16px rgba(88,166,255,0.35); }
  50% { transform: translate(-50%,-50%) scale(1.3); box-shadow: 0 0 36px rgba(88,166,255,0.65); }
}

/* Energy rings */
.algo-energy-ring {
  position: absolute; top: 50%; left: 50%; border-radius: 50%; border: 1px solid;
  transform: translate(-50%,-50%);
}
.algo-energy-ring.r1 { width: 60px; height: 60px; border-color: rgba(88,166,255,0.30); animation: eSpin 5s linear infinite; }
.algo-energy-ring.r2 { width: 100px; height: 100px; border-color: rgba(59,130,246,0.20); border-style: dashed; animation: eSpin 10s linear infinite reverse; }
.algo-energy-ring.r3 { width: 150px; height: 150px; border-color: rgba(88,166,255,0.12); animation: eSpin 15s linear infinite; }

/* Energy bolts */
.algo-energy-bolt {
  position: absolute; top: 50%; left: 50%; width: 1px; height: 75px;
  background: linear-gradient(to top, transparent, rgba(88,166,255,0.45));
  transform-origin: bottom center; opacity: 0.2;
}
.algo-energy-bolt.b1 { transform: translate(-50%,-100%) rotate(0deg); animation: boltFlash 3s ease-in-out infinite; }
.algo-energy-bolt.b2 { transform: translate(-50%,-100%) rotate(60deg); animation: boltFlash 3s ease-in-out infinite .5s; }
.algo-energy-bolt.b3 { transform: translate(-50%,-100%) rotate(120deg); animation: boltFlash 3s ease-in-out infinite 1s; }
.algo-energy-bolt.b4 { transform: translate(-50%,-100%) rotate(180deg); animation: boltFlash 3s ease-in-out infinite 1.5s; }
.algo-energy-bolt.b5 { transform: translate(-50%,-100%) rotate(240deg); animation: boltFlash 3s ease-in-out infinite 2s; }
.algo-energy-bolt.b6 { transform: translate(-50%,-100%) rotate(300deg); animation: boltFlash 3s ease-in-out infinite 2.5s; }
@keyframes boltFlash { 0%,100%{opacity:0.10} 50%{opacity:0.5} }

/* Placeholder text */
.algo-placeholder-title {
  font-size: 22px; font-weight: 700; letter-spacing: 6px;
  color: rgba(88,166,255,0.55);
}
.algo-placeholder-sub {
  font-size: 11px; color: rgba(88,166,255,0.35); letter-spacing: 3px; margin-top: 4px;
  font-family: 'Courier New', monospace;
}
.algo-placeholder-tip {
  font-size: 12px; color: var(--text-muted); margin-top: 20px;
  padding: 6px 16px; border-radius: 8px;
  border: 1px solid rgba(88,166,255,0.20);
  background: rgba(88,166,255,0.06);
  animation: tipBlink 2s ease-in-out infinite;
}
@keyframes tipBlink { 0%,100%{opacity:0.55} 50%{opacity:1} }
@keyframes eSpin { from{transform:translate(-50%,-50%) rotate(0)} to{transform:translate(-50%,-50%) rotate(360deg)} }

/* ===== Algorithm empowerment animation (备用) ===== */
.algo-stage {
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px; text-align: center;
}
.algo-rings {
  position: relative; width: 90px; height: 90px; margin-bottom: 12px;
}
.algo-ring {
  position: absolute; border-radius: 50%; border: 2px solid transparent;
}
.algo-ring.r1 {
  inset: 0;
  border-top-color: var(--gold-light); border-right-color: var(--gold);
  animation: algo-spin 3s linear infinite;
}
.algo-ring.r2 {
  inset: 15px;
  border-bottom-color: var(--gold-light); border-left-color: var(--gold-core);
  animation: algo-spin-rev 4s linear infinite;
}
.algo-ring.r3 {
  inset: 30px;
  border-top-color: var(--gold); border-left-color: var(--gold-deep);
  animation: algo-spin 2.5s linear infinite;
}
@keyframes algo-spin { to { transform: rotate(360deg); } }
@keyframes algo-spin-rev { to { transform: rotate(-360deg); } }
.algo-core {
  position: absolute; inset: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88,166,255,0.4), rgba(31,111,235,0.08));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--gold-light);
  animation: algo-float 2s ease-in-out infinite;
}
@keyframes algo-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.algo-orbit {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold-light);
}
.algo-orbit.o1 { top: 0; left: 50%; margin-left: -3px; animation: algo-orbit1 3s linear infinite; }
.algo-orbit.o2 { top: 50%; right: 0; margin-top: -3px; animation: algo-orbit2 4s linear infinite; background: var(--gold); }
.algo-orbit.o3 { bottom: 0; left: 50%; margin-left: -3px; animation: algo-orbit3 3.5s linear infinite; background: var(--gold-deep); }
@keyframes algo-orbit1 { from { transform: rotate(0) translateY(-60px) rotate(0); } to { transform: rotate(360deg) translateY(-60px) rotate(-360deg); } }
@keyframes algo-orbit2 { from { transform: rotate(0) translateX(60px) rotate(0); } to { transform: rotate(360deg) translateX(60px) rotate(-360deg); } }
@keyframes algo-orbit3 { from { transform: rotate(0) translateY(60px) rotate(0); } to { transform: rotate(360deg) translateY(60px) rotate(-360deg); } }
.algo-particles { position: absolute; inset: -20px; pointer-events: none; }
.algo-particle {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold-light); opacity: 0.6;
  animation: algo-drift 6s ease-in-out infinite;
}
.algo-particle:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
.algo-particle:nth-child(2) { top: 70%; left: 80%; animation-delay: 1.5s; background: var(--gold); }
.algo-particle:nth-child(3) { top: 30%; right: 10%; animation-delay: 3s; background: var(--gold-light); }
.algo-particle:nth-child(4) { bottom: 20%; left: 25%; animation-delay: 4.5s; background: var(--gold-deep); }
@keyframes algo-drift {
  0%,100% { transform: translate(0,0); opacity: 0.3; }
  50% { transform: translate(10px,-15px); opacity: 0.8; }
}
.algo-glow {
  position: absolute; inset: -10px; border-radius: 50%;
  background: radial-gradient(circle, rgba(88,166,255,0.22), transparent 70%);
  animation: algo-pulse 3s ease-in-out infinite;
}
@keyframes algo-pulse { 0%,100% { opacity: 0.4; transform: scale(1); } 50% { opacity: 0.85; transform: scale(1.1); } }
.algo-title {
  font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 6px;
}
.algo-desc {
  font-size: 12px; color: var(--text-muted); max-width: 280px; line-height: 1.6;
}

/* Auto mode count selector */
.auto-count-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-dim);
}
.auto-count-label {
  font-size: 12px; font-weight: 600; color: var(--text-soft); white-space: nowrap;
}
.auto-count-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.count-chip {
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-elevated); cursor: pointer;
  border: 1px solid var(--border-dim);
  transition: all .15s; user-select: none;
}
.count-chip:hover { color: var(--gold-light); border-color: var(--gold-light); }
.count-chip.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff; font-weight: 600;
  box-shadow: 0 0 10px var(--gold-glow);
  border-color: transparent;
}

/* Canvas / preview zone */
.canvas-zone {
  width: 100%;
  height: 200px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 2px dashed var(--border-mid);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  cursor: pointer;
}
.canvas-zone:hover { border-color: var(--gold-light); box-shadow: 0 0 18px var(--gold-glow); }
.canvas-zone::after {
  content: '🔍 点击查看大图'; position: absolute; bottom: 8px; right: 10px;
  font-size: 11px; color: var(--text-soft);
  background: rgba(13,17,23,0.75); padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border-dim);
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.canvas-zone:hover::after { opacity: 1; }
.canvas-zone.dragover { border-color: var(--gold-light); background: rgba(88,166,255,0.08); box-shadow: 0 0 18px var(--gold-glow); }
/* Empty state */
.canvas-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 60px 20px; text-align: center;
  color: var(--text-dim);
}
.canvas-empty-icon { font-size: 48px; opacity: 0.4; }
.canvas-empty-text { font-size: 14px; color: var(--text-muted); }
.canvas-empty-hint { font-size: 12px; color: var(--text-dim); }
.canvas-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(88,166,255,0.06) 0%, rgba(31,111,235,0.03) 100%);
}
.canvas-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(88,166,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(59,130,246,0.08) 0%, transparent 50%);
}
.upload-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; z-index: 1; border: 2px solid var(--gold-light);
  color: var(--gold-light);
  box-shadow: 0 0 16px var(--gold-glow);
}
.upload-text { font-size: 14px; color: var(--text-soft); z-index: 1; }
.upload-hint { font-size: 12px; color: var(--text-dim); z-index: 1; text-align: center; }

/* Auto info card */
.auto-info-card {
  padding: 24px; margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  text-align: center;
}
.auto-info-card .algo-stage {
  flex-direction: column; align-items: center; gap: 8px;
}
.auto-info-card .auto-feats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border-dim);
}
.auto-info-card .auto-feat { font-size: 12px; color: var(--text-muted); }

/* Auto mode card */
.auto-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 16px; text-align: center;
}
.auto-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(88,166,255,0.20), rgba(31,111,235,0.05));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; border: 2px solid var(--gold-light); color: var(--gold-light);
  box-shadow: 0 0 16px var(--gold-glow);
}
.auto-title { font-size: 15px; font-weight: 600; color: var(--text-main); }
.auto-desc { font-size: 12px; color: var(--text-muted); max-width: 280px; line-height: 1.6; }
.auto-feats { display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; }
.auto-feat { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.auto-feat .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold-light); flex-shrink: 0; }

/* Textarea (manual mode) */
.text-input {
  width: 100%; min-height: 80px;
  background: var(--bg-input); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 12px;
  font-size: 13px; color: var(--text-main); resize: vertical; outline: none;
  transition: border .15s, box-shadow .15s;
}
.text-input:focus { border-color: var(--gold-light); box-shadow: 0 0 0 3px rgba(88,166,255,0.15); }
.text-input::placeholder { color: var(--text-dim); }

/* Quick templates */
.quick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-tag {
  padding: 5px 10px; font-size: 12px; border-radius: var(--radius-full);
  background: var(--bg-elevated); color: var(--text-muted);
  border: 1px solid var(--border-dim); transition: all .15s;
}
.quick-tag:hover { border-color: var(--gold-light); color: var(--gold-light); background: rgba(88,166,255,0.08); }

/* Slider */
.slider-wrap { height: 4px; background: var(--border-mid); border-radius: var(--radius-full); position: relative; margin-top: 8px; }
.slider-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--gold-light); border-radius: var(--radius-full); box-shadow: 0 0 8px var(--gold-glow); }
.slider-knob {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-main); border: 2px solid var(--gold-light); top: -5px;
  cursor: pointer; box-shadow: 0 0 8px var(--gold-glow);
}

/* Select */
.select-input {
  width: 100%; padding: 9px 12px; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); color: var(--text-main); outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238B949E' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
  transition: border-color .15s, box-shadow .15s;
}
.select-input:focus { border-color: var(--gold-light); box-shadow: 0 0 0 3px rgba(88,166,255,0.15); }

/* Hint */
.hint-box {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11px; color: var(--text-muted); margin-top: 6px;
}
.hint-icon { color: var(--gold-light); flex-shrink: 0; }

/* Param panel (legacy) */
.param-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 0;
}
.mode-switch {
  display: flex; background: var(--bg-elevated);
  border-radius: var(--radius-sm); padding: 3px;
  border: 1px solid var(--border-dim); margin-bottom: 16px;
}
.mode-btn {
  flex: 1; padding: 9px 0; text-align: center; font-size: 13px;
  color: var(--text-muted); border-radius: 6px; transition: all .15s;
  font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.mode-btn.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  color: #fff;
  box-shadow: 0 2px 10px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative; overflow: hidden;
}
.mode-btn.active::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22) 50%, transparent);
  animation: quantum-sweep 3s ease-in-out infinite;
}
.mode-btn .tag { font-size: 9px; padding: 1px 5px; border-radius: 3px; background: var(--orange); color: #fff; font-weight: 600; }
.mode-btn.active .tag { background: #fff; color: var(--orange-deep); }

/* ===== Progress zone ===== */
.progress-zone {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 20px;
}
.pz-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.pz-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-mid); border-top-color: var(--gold-light);
  animation: pz-spin 0.8s linear infinite;
  box-shadow: 0 0 10px var(--gold-glow);
}
@keyframes pz-spin { to { transform: rotate(360deg); } }
.pz-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.pz-pct { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--gold-light); }
.pz-bar-wrap { height: 6px; background: var(--bg-elevated); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 6px; }
.pz-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-light));
  border-radius: var(--radius-full);
  transition: width .4s ease;
  position: relative;
  box-shadow: 0 0 10px var(--gold-glow);
}
.pz-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: pz-shimmer 1.5s linear infinite;
}
@keyframes pz-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.pz-eta { font-size: 11px; color: var(--text-muted); margin-bottom: 14px; }
.pz-stages {
  display: flex; justify-content: space-between; gap: 4px;
  position: relative;
}
.pz-stages::before {
  content: ''; position: absolute; top: 10px; left: 10px; right: 10px;
  height: 2px; background: var(--border-dim); z-index: 0;
}
.pz-stage {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; z-index: 1; flex: 1;
}
.pz-stage-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-card); border: 2px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-dim); transition: all .3s;
}
.pz-stage.done .pz-stage-dot {
  background: var(--gold-deep); border-color: var(--gold-deep); color: #fff;
  box-shadow: 0 0 8px var(--gold-glow);
}
.pz-stage.active .pz-stage-dot {
  background: var(--gold-light); border-color: var(--gold-light); color: #fff;
  animation: pz-pulse-dot 1s ease-in-out infinite;
}
@keyframes pz-pulse-dot { 0%,100% { box-shadow: 0 0 0 0 rgba(88,166,255,0.5); } 50% { box-shadow: 0 0 0 6px rgba(88,166,255,0); } }
.pz-stage-name {
  font-size: 11px; color: var(--text-dim); transition: color .3s;
}
.pz-stage.done .pz-stage-name { color: var(--gold-light); font-weight: 500; }
.pz-stage.active .pz-stage-name { color: var(--gold-light); font-weight: 600; }
.pz-cancel {
  margin-top: 14px; width: 100%; padding: 8px;
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-elevated); border: 1px solid var(--border-dim);
  border-radius: var(--radius-full); transition: all .15s;
}
.pz-cancel:hover { border-color: var(--wine); color: var(--wine); background: rgba(248,81,73,0.08); }

/* Result area */
.result-area { width: 100%; margin-top: 16px; }
.result-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  /* 最多6列 */
  max-columns: 6;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  max-width: 100%;
}
.result-item {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border-dim);
  overflow: hidden; position: relative; cursor: pointer;
  transition: border .15s, box-shadow .15s;
}
.result-item:hover { border-color: var(--gold-light); box-shadow: 0 0 14px var(--gold-glow); }
.result-item img { width: 100%; height: 100%; object-fit: contain; }
.result-item .dl-btn {
  position: absolute; bottom: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; opacity: 0; transition: opacity .15s;
  box-shadow: 0 2px 8px var(--gold-glow);
}
.result-item:hover .dl-btn { opacity: 1; }

/* ===== Image Viewer (lightbox) ===== */
.img-viewer {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(1,4,9,0.92);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  padding: 20px;
}
.img-viewer.show { opacity: 1; pointer-events: auto; }
.img-viewer-wrap {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  max-width: 100%; max-height: 100%;
}
.img-viewer-img-box {
  position: relative;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,0.7), 0 0 0 1px var(--border-dim);
  background: #0D1117;
  max-width: 90vw; max-height: 75vh;
  display: flex; align-items: center; justify-content: center;
}
.img-viewer-img-box img {
  max-width: 90vw; max-height: 75vh;
  object-fit: contain; border-radius: 12px;
  display: block;
}

/* Compare mode */
.iv-compare-img {
  position: absolute; top: 0; left: 0;
  max-width: 90vw; max-height: 75vh;
  object-fit: contain; border-radius: 12px;
  clip-path: inset(0 50% 0 0);
  transition: clip-path .1s;
}
.iv-compare-img.hidden { display: none; }
.iv-compare-slider {
  position: absolute; top: 0; bottom: 0;
  left: 50%; width: 3px;
  background: var(--gold-light);
  cursor: ew-resize; z-index: 5;
  transform: translateX(-50%);
  box-shadow: 0 0 12px var(--gold-glow);
}
.iv-compare-slider.hidden { display: none; }
.iv-compare-slider::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 2px 12px var(--gold-glow);
}
.iv-compare-slider::after {
  content: '⟷'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff; font-size: 18px; font-weight: bold; z-index: 1;
}
.iv-compare-label {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: 8px;
  background: rgba(13,17,23,0.75); color: var(--text-soft);
  border: 1px solid var(--border-dim);
  font-size: 12px; z-index: 6;
}
.iv-compare-label.hidden { display: none; }
/* 左右导航箭头 */
.iv-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(33,38,45,0.75);
  border: 1px solid var(--border-mid);
  color: var(--text-soft); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; z-index: 2;
}
.iv-nav:hover { background: rgba(88,166,255,0.20); border-color: var(--gold-light); color: var(--gold-light); }
.iv-nav.prev { left: 16px; }
.iv-nav.next { right: 16px; }
.iv-nav.hidden { display: none; }
/* 图片计数 */
.iv-counter {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(13,17,23,0.75); color: var(--text-soft);
  padding: 4px 14px; border-radius: 999px; font-size: 12px;
  z-index: 2; border: 1px solid var(--border-mid);
}
/* 底部操作栏 */
.iv-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 20px; flex-wrap: wrap; justify-content: center;
}
.iv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 999px; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s; white-space: nowrap; font-family: var(--font);
}
.iv-btn:active { transform: scale(0.97); }
.iv-btn-sec {
  background: rgba(88,166,255,0.10);
  border: 1px solid rgba(88,166,255,0.25);
  color: var(--text-soft);
}
.iv-btn-sec:hover { background: rgba(88,166,255,0.20); color: var(--gold-light); }
.iv-btn-pri {
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  color: #fff;
  box-shadow: 0 2px 10px var(--gold-glow);
}
.iv-btn-pri:hover { box-shadow: 0 4px 16px var(--gold-glow); }
.iv-divider {
  width: 1px; height: 24px;
  background: var(--border-mid);
  margin: 0 4px;
}
.iv-close-x {
  position: absolute; top: -36px; right: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(33,38,45,0.75);
  border: 1px solid var(--border-mid);
  color: var(--text-soft); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.iv-close-x:hover { background: rgba(88,166,255,0.20); border-color: var(--gold-light); color: var(--gold-light); }

/* ===== Right sidebar ===== */
.sidebar-right {
  background: var(--bg-card);
  border-left: 1px solid var(--border-dim);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  height: 100%;
}
.hist-head { display: flex; justify-content: space-between; align-items: center; }
.hist-count { font-size: 11px; color: var(--text-muted); }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: all .15s; cursor: pointer; overflow: hidden;
  position: relative;
}
.hist-item:hover { border-color: var(--gold-light); box-shadow: 0 0 12px var(--gold-glow); }
.hist-thumb { width: 100%; aspect-ratio: 1; border-radius: 8px; background-size: cover; background-repeat: no-repeat; background-position: center; background-color: var(--bg-elevated); }
.hist-thumb.t1 { background: linear-gradient(135deg, var(--gold-light), var(--gold-deep)); }
.hist-thumb.t2 { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); }
.hist-thumb.t3 { background: linear-gradient(135deg, var(--gold-light), var(--gold-core)); }
.hist-thumb.t4 { background: linear-gradient(135deg, var(--gold-deep), var(--gold-dark)); }
.api-mini {
  margin-top: auto; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border-dim);
  display: flex; align-items: center; justify-content: space-between;
}
.api-mini-left { display: flex; align-items: center; gap: 8px; }
.api-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-dot); box-shadow: 0 0 6px rgba(63,185,80,0.6); }
.api-mini-title { font-size: 12px; color: var(--text-soft); }
.api-mini-key { font-size: 11px; color: var(--text-muted); }

/* ===== My page (设置/API配置) ===== */
.my-page {
  position: fixed; inset: 0; background: var(--bg-main); z-index: 200;
  display: flex; flex-direction: column;
}
.my-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border-dim);
}
.my-back { font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.my-back:hover { color: var(--gold-light); }
.my-title { font-size: 16px; font-weight: 600; color: var(--text-main); }
.my-body { flex: 1; padding: 24px; overflow-y: auto; max-width: 640px; width: 100%; margin: 0 auto; }
.my-profile {
  display: flex; align-items: center; gap: 14px;
  padding: 20px; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-dim); margin-bottom: 24px;
}
.my-avatar { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-light), var(--gold-deep)); border: 3px solid var(--bg-elevated); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 14px var(--gold-glow); }
.my-name { font-size: 16px; font-weight: 600; color: var(--text-main); }
.my-plan { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.api-sec-title {
  font-size: 14px; font-weight: 600; color: var(--text-main);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.api-sec-title .dot { width: 6px; height: 6px; border-radius: 50%; }
.api-desc {
  font-size: 12px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6;
}
.api-config-card {
  padding: 20px; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-dim);
}
.api-field { margin-bottom: 18px; }
.api-field:last-of-type { margin-bottom: 16px; }
.api-field-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.api-field-label { font-size: 13px; font-weight: 500; color: var(--text-main); }
.api-field-hint { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.api-badge {
  font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full);
  color: var(--green-dot); background: rgba(63,185,80,0.12);
  border: 1px solid rgba(63,185,80,0.30); font-weight: 500;
}
.api-input-row { display: flex; gap: 8px; }
.api-input {
  flex: 1; padding: 10px 12px; font-size: 12px;
  background: var(--bg-input); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); color: var(--text-main);
  font-family: monospace; outline: none; transition: border .15s, box-shadow .15s;
}
.api-input::placeholder { color: var(--text-dim); }
.api-input:focus { border-color: var(--gold-light); box-shadow: 0 0 0 3px rgba(88,166,255,0.15); }
.api-input.hidden-key { -webkit-text-security: disc; text-security: disc; }
.api-show-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  user-select: none; margin-top: 10px;
}
.api-show-toggle input { width: 14px; height: 14px; accent-color: var(--gold-light); cursor: pointer; }
.api-actions { display: flex; gap: 10px; margin-top: 20px; }
.api-save-btn {
  flex: 1; padding: 11px 0; font-size: 13px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
  border: 1px solid var(--gold-core); color: #fff;
  border-radius: var(--radius-full); font-weight: 600;
  box-shadow: 0 3px 14px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: all .15s;
  position: relative; overflow: hidden;
}
.api-save-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22) 50%, transparent);
  animation: quantum-sweep 3s ease-in-out infinite;
}
.api-save-btn:hover { box-shadow: 0 5px 20px var(--gold-glow); transform: translateY(-1px); }
.api-clear-btn {
  padding: 11px 24px; font-size: 13px;
  background: var(--bg-elevated); color: var(--wine);
  border: 1px solid rgba(248,81,73,0.30);
  border-radius: var(--radius-full); font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.api-clear-btn:hover { background: rgba(248,81,73,0.10); border-color: var(--wine); }

/* ===== Toast ===== */
.toast-msg {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); color: var(--text-main);
  padding: 10px 20px; border-radius: var(--radius-full);
  border: 1px solid var(--border-mid);
  font-size: 13px; z-index: 10000; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ===== Mobile bottom nav ===== */
.mobile-nav { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 240px 1fr 220px; height: calc(100vh - 60px); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .sidebar-left { display: none; }
  .sidebar-right { display: none; }
  .nav-tabs { display: none; }
  .mobile-nav {
    display: flex; background: var(--bg-card);
    border-top: 1px solid var(--border-dim);
    position: sticky; bottom: 0; z-index: 100;
  }
  .mn-item {
    flex: 1; text-align: center; padding: 8px 0 10px;
    font-size: 11px; color: var(--text-dim);
    transition: color .15s;
  }
  .mn-item.active { color: var(--gold-light); }
  .mn-icon { font-size: 18px; margin-bottom: 2px; }
  .topbar { padding: 12px 16px; }
  .brand-sub { display: none; }
  .center-area { padding: 16px; }
  .canvas-zone, .canvas-toolbar, .progress-zone, .param-panel, .result-area { max-width: 100%; }
}
@media (max-width: 480px) {
  .brand-name { font-size: 13px; }
  .my-btn { padding: 6px 10px; font-size: 12px; }
  .my-btn span { display: none; }
  .pz-stages { gap: 2px; }
  .pz-stage-name { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .algo-ring, .algo-core, .algo-orbit, .algo-particle, .algo-glow,
  .algo-energy-core, .algo-energy-ring, .algo-energy-bolt,
  .pz-spinner, .pz-bar-fill::after, .pz-stage.active .pz-stage-dot,
  .nav-tab.active::after, .btn-primary::after, .mode-btn.active::after, .api-save-btn::after, .gen-btn::after,
  .logo-wrap img, .logo-wrap::after, .splash-spinner {
    animation: none !important;
  }
}


/* ===== 所有图片和按钮统一8px圆角 ===== */
img { border-radius: 8px; }
.result-item, .result-video { border-radius: 8px !important; overflow: hidden; }
.upload-thumb { border-radius: 8px !important; overflow: hidden; }
.hist-thumb { border-radius: 8px !important; overflow: hidden; }
.canvas-thumb { border-radius: 8px !important; }
.login-logo img { border-radius: 8px !important; }
.splash-logo img { border-radius: 8px !important; }

/* 结果项适配 */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
/* 最多6列：当容器足够宽时限制 */
.result-grid {
  grid-template-columns: repeat(min(6, auto-fill), minmax(0, 1fr));
}
.result-item {
  aspect-ratio: 1;
  min-height: 100px;
}
@media (max-width: 860px) {
  .result-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
