:root {
  --bg: #0f0f14;
  --bg-card: #1a1a24;
  --bg-input: #22222e;
  --border: #2e2e3a;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --accent: #7c5cfc;
  --accent-hover: #6d4ef5;
  --accent-soft: rgba(124, 92, 252, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 560px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#app {
  width: 100%;
  max-width: var(--max-width);
  padding: 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.step { display: none; }
.step.active { display: flex; flex-direction: column; align-items: center; gap: 20px; }

.hero { text-align: center; margin-bottom: 8px; }
.hero h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.5px; }
.tagline { color: var(--text-dim); margin-top: 8px; font-size: 1rem; }

h2 { font-size: 1.4rem; font-weight: 600; text-align: center; }

/* Dropzone */
.dropzone {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-icon { color: var(--text-dim); margin-bottom: 12px; }
.dropzone-text { font-size: 1.05rem; }
.dropzone-text .link { color: var(--accent); text-decoration: underline; }
.dropzone-hint { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }

/* Preview */
.preview-container { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.image-preview {
  max-width: 100%;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
  max-height: 400px;
  object-fit: contain;
}
.hidden { display: none !important; }

/* Prompt */
.prompt-section { display: flex; flex-direction: column; gap: 6px; }
.prompt-section label { font-size: 0.9rem; font-weight: 500; }
.optional { color: var(--text-dim); font-weight: 400; }
#prompt-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
#prompt-input:focus { border-color: var(--accent); }
.prompt-hint { color: var(--text-dim); font-size: 0.8rem; }

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--text); }

/* Generating */
.generating-preview {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-text { color: var(--text-dim); font-size: 0.9rem; text-align: center; }

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 2px;
}

/* Ad container */
.ad-container {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.ad-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}
.ad-slot { min-height: 120px; display: flex; align-items: center; justify-content: center; }
.ad-placeholder { text-align: center; padding: 20px; }
.ad-placeholder p { color: var(--text-dim); font-size: 0.9rem; }
.ad-placeholder-sub { font-size: 0.75rem !important; margin-top: 4px; }

/* Result */
.result-video-wrapper {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
#result-video { width: 100%; display: block; }

.actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.share-buttons { display: flex; gap: 8px; }
.btn-share {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}
.btn-share:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.08); }

/* Error */
.error-message { color: #ff6b6b; text-align: center; font-size: 0.95rem; }

/* Footer */
footer {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.8rem; }
  h2 { font-size: 1.2rem; }
  .dropzone { padding: 32px 16px; }
  .actions { flex-direction: column; }
  .btn-primary { width: 100%; }
}
