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

:root {
  --bg: #0a0a0f;
  --surface: #14141f;
  --surface-hover: #1c1c2e;
  --border: #2a2a3e;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --accent: #6c5ce7;
  --accent-hover: #7c6cf7;
  --danger: #e74c5c;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

header {
  text-align: center;
  padding: 3rem 1rem 1rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe, #fd79a8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-dim);
  margin-top: 0.25rem;
  font-size: 1.1rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Drop Zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.dropzone-content svg {
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.dropzone-content p { color: var(--text-dim); }

.browse-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.hint {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  opacity: 0.6;
}

/* Image List */
.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: grab;
  transition: border-color 0.2s, transform 0.15s;
}

.image-item:hover { border-color: var(--accent); }

.image-item.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.image-item.dragover-item {
  border-color: var(--accent);
  transform: scale(1.05);
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: var(--danger);
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-item:hover .remove-btn { opacity: 1; }

.image-item .index-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Settings */
.settings {
  margin-top: 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.settings h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.setting label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-group input {
  width: 80px;
}

.unit {
  font-size: 0.85rem;
  color: var(--text-dim);
}

input[type="number"], select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

input[type="color"] {
  width: 48px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  padding: 2px;
}

select { width: 100%; }

.btn-primary {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  text-align: center;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  padding: 0.75rem 2rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--surface-hover); }

/* Progress */
.progress-section {
  margin-top: 2rem;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #a29bfe);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-text {
  margin-top: 0.75rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Result */
.result-section {
  margin-top: 2rem;
  text-align: center;
}

.result-section video {
  width: 100%;
  max-height: 480px;
  border-radius: var(--radius);
  background: #000;
}

.result-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer-brand { margin-top: 0.5rem; }

/* Responsive */
@media (max-width: 500px) {
  .settings-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
  .result-actions { flex-direction: column; }
  .btn-primary, .btn-secondary { width: 100%; }
}
