* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}

.container {
  width: 100%;
  max-width: 620px;
}

h1 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 32px;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 6px;
  font-weight: 500;
}

input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  background: #2a2a4a;
  border: 1px solid #444;
  color: #ccc;
  padding: 6px 14px;
  border-radius: 6px;
  margin-right: 10px;
  cursor: pointer;
}

select, input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.9rem;
}

/* Radio / Toggle group */
.toggle-group {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #333;
}

.toggle-group input { display: none; }

.toggle-group label {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  background: #1a1a2e;
  cursor: pointer;
  font-size: 0.9rem;
  color: #aaa;
  margin: 0;
  transition: all 0.2s;
  border-right: 1px solid #333;
}

.toggle-group label:last-of-type { border-right: none; }

.toggle-group input:checked + label {
  background: #2d2b55;
  color: #fff;
}

/* Color swatches */
.color-group {
  display: flex;
  gap: 10px;
}

.color-group input { display: none; }

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
}

.color-swatch:hover { transform: scale(1.1); }

.color-group input:checked + .color-swatch {
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.4);
}

.swatch-white  { background: #ffffff; }
.swatch-yellow { background: #ffff00; }
.swatch-cyan   { background: #00ffff; }
.swatch-green  { background: #00ff00; }
.swatch-pink   { background: #ff00ff; }

/* Watermark section */
.watermark-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.watermark-row .form-group:first-child { flex: 1; }
.watermark-row .form-group:last-child { flex: 0 0 auto; }

.watermark-pos {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #333;
}

.watermark-pos input { display: none; }

.watermark-pos label {
  padding: 10px 14px;
  background: #1a1a2e;
  cursor: pointer;
  font-size: 0.8rem;
  color: #aaa;
  margin: 0;
  transition: all 0.2s;
  white-space: nowrap;
}

.watermark-pos input:checked + label {
  background: #2d2b55;
  color: #fff;
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s;
}

.btn-submit:hover { opacity: 0.9; }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #bbb;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #7c3aed;
  cursor: pointer;
}

/* Progress */
.progress-section {
  display: none;
  margin-top: 32px;
  text-align: center;
}

.progress-section.active { display: block; }

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #1a1a2e;
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #3b82f6);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

.progress-msg {
  color: #aaa;
  font-size: 0.9rem;
}

.progress-pct {
  color: #a78bfa;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Results */
.results-section {
  display: none;
  margin-top: 32px;
  text-align: center;
}

.results-section.active { display: block; }

.results-section h2 {
  color: #60a5fa;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.download-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-download {
  padding: 12px 28px;
  background: #1a1a2e;
  border: 1px solid #444;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-download:hover { background: #2d2b55; }

.btn-new {
  margin-top: 20px;
  padding: 10px 24px;
  background: transparent;
  border: 1px solid #555;
  border-radius: 8px;
  color: #aaa;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-new:hover { color: #fff; border-color: #888; }

/* Error */
.error-msg {
  color: #f87171;
  background: #1a1a2e;
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  display: none;
}

.error-msg.active { display: block; }

/* ========== Project List ========== */

.project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.project-card:hover {
  border-color: #7c3aed;
  background: #1e1e38;
}

.project-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e0e0e0;
}

.project-card-meta {
  font-size: 0.8rem;
  color: #777;
  margin-top: 2px;
}

.btn-delete {
  background: none;
  border: none;
  color: #555;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.btn-delete:hover { color: #f87171; background: rgba(248,113,113,0.1); }

.empty-msg {
  text-align: center;
  color: #666;
  padding: 32px 0;
  font-size: 0.9rem;
}

/* ========== Breadcrumb ========== */

.breadcrumb {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 20px;
}

.breadcrumb a {
  color: #60a5fa;
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* ========== Section Boxes ========== */

.section-box {
  background: #14142a;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* ========== Completed Cards ========== */

.completed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.completed-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 10px 14px;
  transition: border-color 0.2s, background 0.2s;
  cursor: grab;
}

.completed-card.selected {
  border-color: #7c3aed;
  background: #1e1e3a;
}

.completed-card.dragging { opacity: 0.4; }

.completed-card.drag-over {
  border-color: #3b82f6;
  border-style: dashed;
}

.drag-handle {
  color: #444;
  font-size: 1rem;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.job-check {
  width: 18px;
  height: 18px;
  accent-color: #7c3aed;
  cursor: pointer;
  flex-shrink: 0;
}

.completed-info { flex: 1; min-width: 0; }

.completed-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.completed-meta {
  font-size: 0.75rem;
  color: #666;
  margin-top: 1px;
}

.completed-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.btn-dl {
  padding: 5px 12px;
  background: #2a2a4a;
  border: 1px solid #3a3a5a;
  border-radius: 6px;
  color: #ccc;
  font-size: 0.78rem;
  text-decoration: none;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-dl:hover { background: #3a3a5a; color: #fff; }

.btn-merge {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-merge:hover { opacity: 0.9; }
.btn-merge:disabled { opacity: 0.4; cursor: wait; }

/* ========== Active / Error Cards ========== */

.active-card {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 6px;
}

.active-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.job-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-done { background: #064e3b; color: #6ee7b7; }
.status-processing, .status-queued { background: #1e3a5f; color: #93c5fd; }
.status-error { background: #4c1d1d; color: #fca5a5; }

.btn-delete-sm {
  background: none;
  border: none;
  color: #555;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.btn-delete-sm:hover { color: #f87171; }

.job-progress { margin-top: 4px; }
.job-progress .progress-bar-bg { margin: 6px 0 4px; }

.job-error {
  color: #fca5a5;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ========== Merge Cards ========== */

.merge-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 6px;
}

.merge-info { flex: 1; min-width: 0; }

.merge-title {
  font-size: 0.9rem;
  color: #e0e0e0;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merge-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* ========== New MV Section ========== */

.new-mv-section {
  background: #14142a;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 8px;
}

.new-mv-section summary {
  cursor: pointer;
  font-weight: 600;
  color: #a78bfa;
  font-size: 0.95rem;
  margin-bottom: 16px;
  outline: none;
}

.new-mv-section[open] summary { margin-bottom: 20px; }
