* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #0d0f14;
  color: #e6e8ee;
  min-height: 100vh;
}
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }
.hint { color: #565d70; font-size: 12px; }
.error-msg { color: #ff7a8a; font-size: 13px; margin-top: 8px; }

/* ---------- 登录卡片 ---------- */
#auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: #171a22;
  border: 1px solid #262b3a;
  border-radius: 16px;
  padding: 36px 32px;
}
.auth-title {
  font-size: 26px;
  text-align: center;
  background: linear-gradient(120deg, #8b7cf6, #4fd1c5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-sub { text-align: center; color: #8a90a2; font-size: 13px; margin: 6px 0 24px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1;
  padding: 9px;
  background: transparent;
  border: 1px solid #262b3a;
  border-radius: 8px;
  color: #8a90a2;
  cursor: pointer;
  font-size: 14px;
}
.tab.active { border-color: #8b7cf6; color: #e6e8ee; background: rgba(139,124,246,.08); }
#auth-form input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: #0d0f14;
  border: 1px solid #262b3a;
  border-radius: 8px;
  color: #e6e8ee;
  font-size: 14px;
  outline: none;
}
#auth-form input:focus { border-color: #8b7cf6; }

/* ---------- 按钮 ---------- */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(120deg, #8b7cf6, #6a5ae0);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border: 1px solid #262b3a;
  border-radius: 8px;
  color: #8a90a2;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:hover { color: #e6e8ee; border-color: #8a90a2; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid #1c2029;
  position: sticky;
  top: 0;
  background: rgba(13,15,20,.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand { font-size: 17px; font-weight: 600; }
.user-area { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #8a90a2; }

.container { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
.panel {
  background: #12151d;
  border: 1px solid #1c2029;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel-title { font-size: 15px; margin-bottom: 14px; }
.panel-title small { color: #565d70; font-weight: normal; margin-left: 8px; font-size: 12px; }

/* ---------- 创作区 ---------- */
#prompt-input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: #0d0f14;
  border: 1px solid #262b3a;
  border-radius: 10px;
  padding: 14px;
  color: #e6e8ee;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  font-family: inherit;
}
#prompt-input:focus { border-color: #8b7cf6; }

.image-tray { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.image-list { display: contents; }
.dropzone {
  width: 84px;
  height: 84px;
  border: 1px dashed #3a4157;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #565d70;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.5;
}
.dropzone:hover, .dropzone.dragover { border-color: #8b7cf6; color: #8b7cf6; }
.thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #262b3a;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.thumb .frame-badge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 0;
  text-align: center;
  font-size: 11px;
  background: rgba(0,0,0,.55);
  color: #aab;
  cursor: pointer;
  user-select: none;
}
.thumb .frame-badge.first { background: rgba(139,124,246,.85); color: #fff; }
.thumb .frame-badge.last { background: rgba(79,209,197,.8); color: #06251f; }

.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.control-label { width: 48px; color: #8a90a2; font-size: 13px; flex-shrink: 0; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px;
  background: #0d0f14;
  border: 1px solid #262b3a;
  border-radius: 8px;
  color: #8a90a2;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover:not(:disabled) { border-color: #8b7cf6; color: #e6e8ee; }
.chip.active { border-color: #8b7cf6; color: #fff; background: rgba(139,124,246,.14); }
.chip:disabled { opacity: .35; cursor: not-allowed; }
.chip small { display: block; font-size: 11px; color: #565d70; margin-top: 2px; }
.chip.active small { color: #b9aef8; }

#duration-slider { flex: 1; max-width: 320px; accent-color: #8b7cf6; }
#duration-label { color: #e6e8ee; font-size: 14px; min-width: 40px; }

.submit-row { justify-content: space-between; margin-top: 18px; }
.submit-row .btn-primary { width: auto; padding: 11px 36px; }
.eta { color: #4fd1c5; font-size: 14px; }

/* ---------- 模板中心 ---------- */
.template-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.tpl-card {
  flex: 0 0 220px;
  background: #0d0f14;
  border: 1px solid #262b3a;
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.tpl-card:hover { border-color: #8b7cf6; }
.tpl-card .tpl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tpl-card .tpl-title { font-size: 14px; }
.tpl-card .tpl-cat {
  font-size: 11px;
  color: #4fd1c5;
  border: 1px solid rgba(79,209,197,.35);
  border-radius: 20px;
  padding: 1px 8px;
  flex-shrink: 0;
}
.tpl-card .tpl-preview {
  font-size: 12px;
  color: #565d70;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 任务卡片 ---------- */
.job-list { display: flex; flex-direction: column; gap: 12px; }
.job-card {
  background: #0d0f14;
  border: 1px solid #262b3a;
  border-radius: 10px;
  padding: 14px 16px;
}
.job-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.status-chip {
  font-size: 12px;
  border-radius: 20px;
  padding: 2px 10px;
  flex-shrink: 0;
}
.status-queued { background: rgba(240,180,60,.14); color: #f0b43c; }
.status-generating { background: rgba(139,124,246,.16); color: #b9aef8; }
.status-success { background: rgba(79,209,197,.13); color: #4fd1c5; }
.status-failed { background: rgba(255,110,130,.13); color: #ff7a8a; }
.job-mode { font-size: 12px; color: #565d70; }
.job-meta { font-size: 12px; color: #565d70; }
.job-prompt { font-size: 13px; color: #aab0c2; line-height: 1.6; margin-bottom: 8px; word-break: break-all; }
.job-info { font-size: 13px; color: #8a90a2; line-height: 1.8; }
.job-info .accent { color: #4fd1c5; }
.job-info .warn { color: #ff7a8a; }
.job-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn-small {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid #262b3a;
  background: transparent;
  color: #aab0c2;
  cursor: pointer;
}
.btn-small:hover { border-color: #8b7cf6; color: #fff; }
.btn-small.danger:hover { border-color: #ff7a8a; color: #ff7a8a; }
.pan-box {
  margin-top: 10px;
  background: #12151d;
  border: 1px solid #1c2029;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.8;
  word-break: break-all;
}
.pan-box a { color: #8b7cf6; }
.empty-hint { color: #565d70; font-size: 13px; text-align: center; padding: 20px 0 8px; }

@media (max-width: 560px) {
  .control-label { width: 100%; }
  .submit-row { flex-direction: column; align-items: stretch; }
  .submit-row .btn-primary { width: 100%; }
}

.job-images {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.job-images img {
  height: 64px;
  width: auto;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease;
}
.job-images a:hover img {
  transform: scale(1.05);
}

.encrypt-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #aab0c2;
  cursor: pointer;
  user-select: none;
}
.encrypt-toggle input { accent-color: #7c6cf0; width: 15px; height: 15px; cursor: pointer; }
.encrypt-toggle small { color: #6e7488; margin-left: 6px; }
.encrypt-toggle small b { color: #9f94e8; }
.encrypt-note { color: #c9b478; font-size: 12.5px; }

.chip-ratio {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 10px 6px;
  line-height: 1;
}
.chip-ratio svg { display: block; opacity: 0.9; }
.chip-ratio span { font-size: 11.5px; letter-spacing: 0.02em; }
