:root {
  --brand: #6e5dfb;
  --brand-hi: #8b7cff;
}

html, body { font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

/* ===== Panels ===== */
.panel {
  background: linear-gradient(180deg, rgba(35,40,54,0.6), rgba(26,30,40,0.6));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 30px -10px rgba(0,0,0,0.5);
}

/* ===== Step indicator ===== */
.step-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(35,40,54,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  color: #cbd5e1; font-size: 13px; font-weight: 500;
  transition: all .2s ease;
}
.step-chip .num { font-weight: 700; color: #94a3b8; }
.step-chip.active { background: rgba(110,93,251,0.18); border-color: rgba(110,93,251,0.4); color: #fff; }
.step-chip.active .num { color: var(--brand-hi); }
.step-chip.disabled { opacity: 0.5; }
.step-chip.done { border-color: rgba(16,185,129,0.5); color: #d1fae5; }
.step-chip.done .num { color: #34d399; }

/* ===== Buttons ===== */
.btn-primary {
  background: linear-gradient(180deg, var(--brand-hi), var(--brand));
  color: white; font-weight: 600;
  padding: 12px 16px; border-radius: 12px;
  transition: all .15s ease;
  box-shadow: 0 8px 20px -8px rgba(110,93,251,0.6);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: rgba(46,52,70,0.8); color: #e2e8f0;
  font-weight: 500; padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  transition: all .15s ease;
}
.btn-secondary:hover { background: rgba(58,66,88,0.95); }

.btn-success {
  background: linear-gradient(180deg, #10b981, #059669);
  color: white; font-weight: 600;
  padding: 12px 16px; border-radius: 12px;
  transition: all .15s ease;
  box-shadow: 0 8px 20px -8px rgba(16,185,129,0.6);
}
.btn-success:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ===== Dropzone ===== */
.dropzone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  min-height: 200px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .15s ease;
  background: rgba(11,13,18,0.4);
  position: relative;
  overflow: hidden;
}
.dropzone:hover { border-color: rgba(139,124,255,0.5); background: rgba(110,93,251,0.05); }
.dropzone.drag { border-color: var(--brand-hi); background: rgba(110,93,251,0.1); }
.dropzone-empty { text-align: center; padding: 28px 20px; color: #cbd5e1; }
.dropzone-preview { width: 100%; height: 100%; position: relative; }
.dropzone-preview img { width: 100%; max-height: 340px; object-fit: contain; display: block; }
.badge-remove {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 999px;
  background: rgba(0,0,0,0.6); color: white;
  display: grid; place-items: center; font-size: 14px;
  border: 1px solid rgba(255,255,255,0.12);
}
.badge-remove:hover { background: rgba(220,38,38,0.8); }

/* ===== Config selects ===== */
.cfg-select {
  width: 100%;
  background: rgba(18,21,29,0.9);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 6px 8px; font-size: 13px;
}

/* ===== Result area ===== */
.result-area { min-height: 380px; display: flex; flex-direction: column; justify-content: center; }
.result-empty { text-align: center; padding: 40px; border: 2px dashed rgba(255,255,255,0.08); border-radius: 14px; }
.result-loading { text-align: center; padding: 40px; }
.result-error { text-align: center; padding: 40px; background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.25); border-radius: 14px; }

/* ===== Spinner ===== */
.spinner {
  width: 44px; height: 44px; border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--brand-hi);
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Variation cards ===== */
.var-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: rgba(11,13,18,0.6);
  border: 1px solid rgba(255,255,255,0.06);
}
.var-card.pending { opacity: 0.65; }
.var-card.generating { border-color: rgba(139,124,255,0.5); animation: pulseBorder 1.6s ease-in-out infinite; }
@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,124,255,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(139,124,255,0); }
}
.var-card.failed { border-color: rgba(220,38,38,0.5); }
.var-card .bg-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
}
.var-card .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.65));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12px;
  opacity: 0; transition: opacity .15s ease;
}
.var-card:hover .overlay { opacity: 1; }
.var-card .overlay .row { display: flex; gap: 6px; flex-wrap: wrap; }
.var-card .status-body { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; }
.var-card .chip {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.65); color: #e2e8f0;
  font-size: 11px; font-weight: 600;
}
.var-chip-btn {
  background: rgba(0,0,0,0.65);
  color: white; padding: 6px 10px; border-radius: 8px;
  font-size: 12px; border: 1px solid rgba(255,255,255,0.15);
}
.var-chip-btn:hover { background: rgba(0,0,0,0.9); }

/* ===== File list (batch) ===== */
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; background: rgba(18,21,29,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
.file-item img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.file-item .name { flex: 1; font-size: 13px; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .remove { color: #94a3b8; }
.file-item .remove:hover { color: #f87171; }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.modal-card {
  width: min(820px, 92vw);
  max-height: 90vh; display: flex; flex-direction: column;
  background: #12151d;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  overflow: hidden;
}
.tab-btn {
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  border-radius: 10px 10px 0 0;
  color: #94a3b8;
  border: 1px solid transparent;
  border-bottom: none;
}
.tab-btn.active { color: #fff; background: rgba(110,93,251,0.18); border-color: rgba(110,93,251,0.35); }
.prompt-ta {
  width: 100%; min-height: 360px;
  background: #0b0d12; color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px; font-size: 13px; line-height: 1.55;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  resize: vertical;
}

/* ===== Toasts ===== */
.toast {
  min-width: 260px; max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px; font-weight: 500;
  background: #1a1e28;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 15px 40px -10px rgba(0,0,0,0.6);
  animation: toastIn .2s ease;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error   { border-left: 4px solid #ef4444; }
.toast.warn    { border-left: 4px solid #f59e0b; }
.toast.info    { border-left: 4px solid #6e5dfb; }
@keyframes toastIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
