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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #e0e0e0;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.container {
  max-width: 720px;
  margin: 0 auto;
}

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

header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

header p {
  color: #94a3b8;
  font-size: 0.95rem;
}

.card {
  background: rgba(30, 27, 75, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #c4b5fd;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #a5b4fc;
  margin-bottom: 0.35rem;
}

.required {
  color: #f87171;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(15, 12, 41, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #64748b;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.hint {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.3rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: #c4b5fd;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #8b5cf6;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  margin-top: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hidden {
  display: none;
}

#resultContent {
  font-size: 0.9rem;
  line-height: 1.6;
}

.result-success {
  padding: 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  color: #6ee7b7;
}

.result-error {
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  color: #fca5a5;
}

.result-json {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(15, 12, 41, 0.8);
  border-radius: 10px;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: #a5b4fc;
  max-height: 400px;
  overflow-y: auto;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

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

/* --- Progress bar --- */
.progress-wrap {
  margin-top: 0.85rem;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(15, 12, 41, 0.7);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #60a5fa);
  border-radius: 999px;
  transition: width 0.4s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.progress-text {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #a5b4fc;
  font-variant-numeric: tabular-nums;
}

/* --- Video player --- */
.video-frame {
  margin-top: 1.25rem;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.video-frame video {
  display: block;
  width: 100%;
  max-height: 60vh;
  background: #000;
}

/* --- Action row (download + copy) --- */
.action-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-secondary {
  flex: 1;
  min-width: 140px;
  padding: 0.85rem 1rem;
  background: rgba(15, 12, 41, 0.6);
  color: #c4b5fd;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-align: center;
}

.btn-secondary:hover {
  background: rgba(139, 92, 246, 0.15);
  transform: translateY(-1px);
}

a.btn-primary {
  display: inline-block;
  flex: 1;
  min-width: 140px;
  text-decoration: none;
  text-align: center;
}

.result-info {
  padding: 1rem;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 10px;
  color: #93c5fd;
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  body {
    padding: 1rem 0.5rem;
  }

  .card {
    padding: 1.25rem;
  }
}
