:root {
  --bg: #0b0f19;
  --card: rgba(20, 27, 45, 0.72);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent2: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
  animation: floatOrb 14s ease-in-out infinite alternate;
}
.orb-1 { width: 420px; height: 420px; background: #6366f1; top: -120px; left: -100px; }
.orb-2 { width: 360px; height: 360px; background: #06b6d4; bottom: -100px; right: -80px; animation-delay: -5s; }
.orb-3 { width: 280px; height: 280px; background: #a855f7; top: 45%; left: 55%; animation-delay: -9s; }

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(35px, -30px) scale(1.1); }
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 {
  font-size: 1.45rem;
  font-weight: 700;
  background: linear-gradient(90deg, #fff, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

.logo-pulse {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.45);
  animation: pulseGlow 2.8s infinite;
}
.logo-pulse svg { width: 24px; height: 24px; color: #fff; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 18px rgba(99, 102, 241, 0.45); }
  50% { box-shadow: 0 0 30px rgba(6, 182, 212, 0.65); }
}

.card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  animation: fadeSlide 0.35s ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.url-row { display: flex; gap: 12px; }
input[type="text"] {
  flex: 1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 0.96rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
}
button:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 0.96rem;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { opacity: 0.92; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 12px;
  display: flex; align-items: center; gap: 8px;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.error-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.9rem;
}

.preview-header { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.thumb {
  width: 150px; height: 88px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.preview-meta h2 { font-size: 1.15rem; margin-top: 6px; line-height: 1.35; }
.uploader { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 0.75rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge.engine { background: rgba(99, 102, 241, 0.25); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }
.badge.duration { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }

.mode-tabs {
  display: flex; gap: 10px;
  margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.6);
  padding: 5px; border-radius: 12px;
}
.tab-btn {
  flex: 1; padding: 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(6, 182, 212, 0.3));
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.format-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}
.format-item:hover { transform: translateY(-2px); border-color: rgba(103, 232, 249, 0.5); }
.format-item.selected {
  border-color: var(--accent2);
  background: rgba(6, 182, 212, 0.15);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}
.format-label { font-weight: 700; font-size: 0.95rem; }
.format-note { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.btn-download {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}
.btn-download:hover { opacity: 0.94; }

.queue-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.count-pill {
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 10px; border-radius: 999px; font-size: 0.8rem;
}
.empty-state { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 0.92rem; }

.job-list { display: flex; flex-direction: column; gap: 12px; }
.job-item {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  animation: fadeSlide 0.25s ease;
}
.job-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.job-title { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-stats { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }

.progress-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--success));
  background-size: 200% 100%;
  transition: width 0.3s ease;
  animation: shimmer 2s linear infinite;
}
.progress-fill.done { background: var(--success); animation: none; }
.progress-fill.error { background: var(--danger); animation: none; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.btn-cancel {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
}
