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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #0a0a0f;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

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

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.card {
  background: #13131a;
  border: 1px solid #1e1e2a;
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #aaa;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

textarea, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #0a0a0f;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 1rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

textarea:focus, input:focus {
  outline: none;
  border-color: #a855f7;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 0.75rem;
}

.form-group.sm input {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}

#generateBtn {
  width: 100%;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#generateBtn:hover {
  opacity: 0.9;
}

#generateBtn:active {
  transform: scale(0.98);
}

#generateBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#generateBtn.loading .btn-text { display: none; }
#generateBtn.loading .spinner { display: block; }

.result-card.hidden { display: none; }
#videoContainer.hidden { display: none; }
#errorContainer.hidden { display: none; }

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

#statusLabel {
  font-weight: 700;
  font-size: 1.05rem;
}

#jobId {
  font-size: 0.8rem;
  color: #666;
  font-family: monospace;
}

.progress-bar {
  height: 6px;
  background: #1e1e2a;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a855f7, #ec4899);
  border-radius: 3px;
  transition: width 0.5s ease;
}

video {
  width: 100%;
  border-radius: 12px;
  background: #000;
}

.video-actions {
  margin-top: 1rem;
  text-align: center;
}

.video-actions a {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: #1e1e2a;
  color: #a855f7;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s;
}

.video-actions a:hover {
  background: #2a2a3a;
}

.error-msg {
  color: #ef4444;
  font-weight: 500;
}

footer {
  text-align: center;
  color: #555;
  font-size: 0.85rem;
  margin-top: 2rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-row .form-group:first-child {
    grid-column: 1 / -1;
  }
  header h1 {
    font-size: 1.8rem;
  }
  .card {
    padding: 1.25rem;
  }
}
