:root {
  --bg: #08080f;
  --card: rgba(22, 22, 34, 0.62);
  --card-solid: #14141f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f8;
  --muted: #9a9aad;
  --muted-2: #6f6f83;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --accent-3: #f59e0b;
  --ok: #22c55e;
  --err: #f43f5e;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.9);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ───────────────────────── фон ───────────────────────── */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 22s ease-in-out infinite;
}

.b1 { width: 620px; height: 620px; left: -220px; top: -220px; background: #6d28d9; }
.b2 { width: 560px; height: 560px; right: -180px; top: 40px; background: #be185d; animation-delay: -7s; }
.b3 { width: 540px; height: 540px; left: 32%; bottom: -300px; background: #0e7490; animation-delay: -14s; opacity: 0.35; }

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(40px, -50px, 0) scale(1.08); }
  66% { transform: translate3d(-35px, 35px, 0) scale(0.94); }
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 100%);
}

/* ───────────────────────── шапка ───────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 940px;
  margin: 0 auto;
  padding: 26px 22px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.3px;
}

.brand em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 26px -8px rgba(139, 92, 246, 0.9);
}

.logo svg { width: 21px; height: 21px; }

.top-badges { display: flex; gap: 7px; }

.pill {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.045);
  color: #d8d8e4;
}

.pill-dim { color: var(--muted); }

/* ───────────────────────── контент ───────────────────────── */

main {
  max-width: 940px;
  margin: 0 auto;
  padding: 8px 22px 60px;
}

.hero {
  text-align: center;
  padding: 34px 0 30px;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5.4vw, 50px);
  line-height: 1.1;
  letter-spacing: -1.4px;
  font-weight: 800;
}

.grad {
  background: linear-gradient(100deg, #a78bfa 0%, #f472b6 45%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
  font-size: 15.5px;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
}

.input-card {
  padding: 16px;
  animation: rise 0.7s 0.06s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 16, 0.6);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.url-row:focus-within {
  border-color: rgba(139, 92, 246, 0.65);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14);
}

.url-icon {
  display: grid;
  place-items: center;
  color: var(--muted-2);
  flex: 0 0 auto;
}

.url-icon svg { width: 19px; height: 19px; }

#url {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 15.5px;
  padding: 11px 0;
}

#url::placeholder { color: var(--muted-2); }

.ghost {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: #d5d5e2;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
}

.ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--border-strong); }
.ghost:active { transform: scale(0.97); }

.options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 2px 2px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 3px;
  border-radius: 13px;
  background: rgba(8, 8, 16, 0.62);
  border: 1px solid var(--border);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s;
}

.segmented button svg { width: 16px; height: 16px; }

.segmented button.active {
  color: #fff;
  background: linear-gradient(140deg, rgba(139, 92, 246, 0.95), rgba(236, 72, 153, 0.85));
  box-shadow: 0 8px 22px -10px rgba(139, 92, 246, 1);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s;
  white-space: nowrap;
}

.chip:hover { color: #fff; border-color: var(--border-strong); }

.chip.active {
  color: #fff;
  border-color: rgba(167, 139, 250, 0.9);
  background: rgba(139, 92, 246, 0.22);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.35);
}

.primary {
  position: relative;
  margin-left: auto;
  border: 0;
  border-radius: 13px;
  padding: 13px 28px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 14px 34px -14px rgba(236, 72, 153, 0.95);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s, opacity 0.2s;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -14px rgba(236, 72, 153, 1);
  filter: brightness(1.06);
}

.primary:active:not(:disabled) { transform: translateY(0) scale(0.985); }

.primary:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }

.primary.loading .btn-label { opacity: 0; }
.primary.loading .spinner { display: block; }

.spinner {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

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

/* ───────────────────────── превью ───────────────────────── */

.preview {
  margin-top: 16px;
  padding: 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.preview.hidden { display: none; }

.thumb-wrap {
  position: relative;
  flex: 0 0 176px;
  aspect-ratio: 16 / 9;
  border-radius: 13px;
  overflow: hidden;
  background: #1b1b28;
}

.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-wrap .duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.preview-info { min-width: 0; flex: 1 1 auto; }

.preview-info .src {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #c4b5fd;
  margin-bottom: 6px;
}

.preview-info h3 {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-info p { margin: 0; color: var(--muted); font-size: 13.5px; }

.preview-info .playlist-note { color: #fbbf24; font-size: 13px; margin-top: 7px; font-weight: 600; }

/* ───────────────────────── задачи ───────────────────────── */

.tasks { margin-top: 34px; }

.tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  padding: 0 4px;
}

.tasks-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #e9e9f2;
}

.link {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  transition: color 0.16s;
}

.link:hover { color: #fff; }
.hidden { display: none !important; }

.list { display: flex; flex-direction: column; gap: 10px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 46px 20px;
  color: var(--muted-2);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}

.empty svg { width: 34px; height: 34px; opacity: 0.55; }
.empty p { margin: 0; font-size: 14px; }

.task {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 15px;
  border-radius: 17px;
  border: 1px solid var(--border);
  background: rgba(20, 20, 32, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
}

.task.done { border-color: rgba(34, 197, 94, 0.32); }
.task.error { border-color: rgba(244, 63, 94, 0.32); }

.task-thumb {
  flex: 0 0 54px;
  height: 54px;
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(140deg, #241f3d, #1a1526);
  display: grid;
  place-items: center;
  color: #7c6bb8;
}

.task-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-thumb svg { width: 22px; height: 22px; }

.task-body { flex: 1 1 auto; min-width: 0; }

.task-title {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }

.task-meta .err { color: #fb7185; }

.bar {
  position: relative;
  height: 5px;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.task.done .bar > i { background: linear-gradient(90deg, #16a34a, #4ade80); }
.task.error .bar > i { background: linear-gradient(90deg, #be123c, #fb7185); }

.bar.indeterminate > i {
  width: 38% !important;
  animation: slide 1.3s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(360%); }
}

.task-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s;
}

.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }

.save {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 11px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #052e16;
  background: linear-gradient(120deg, #4ade80, #22c55e);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 26px -12px rgba(34, 197, 94, 0.9);
  transition: transform 0.15s, filter 0.2s;
}

.save:hover { filter: brightness(1.07); transform: translateY(-1px); }
.save svg { width: 15px; height: 15px; }

/* ───────────────────────── тосты ───────────────────────── */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 50;
  width: min(92vw, 460px);
}

.toast {
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: rgba(24, 24, 38, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #eeeef6;
  font-size: 13.5px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.95);
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.err { border-color: rgba(244, 63, 94, 0.5); }
.toast.ok { border-color: rgba(34, 197, 94, 0.45); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

footer {
  text-align: center;
  padding: 0 22px 40px;
  color: var(--muted-2);
  font-size: 12.5px;
}

footer p { margin: 0; }

/* ───────────────────────── адаптив ───────────────────────── */

@media (max-width: 700px) {
  .topbar { padding: 18px 16px 6px; }
  .top-badges .pill-dim { display: none; }
  main { padding: 4px 16px 40px; }
  .hero { padding: 24px 0 22px; }
  .input-card { padding: 12px; }
  .url-row { flex-wrap: wrap; }
  #url { width: 100%; flex-basis: 100%; padding: 8px 0; }
  .url-icon { display: none; }
  .ghost { margin-left: auto; }
  .options { gap: 9px; }
  .primary { margin-left: 0; width: 100%; }
  .preview { flex-direction: column; align-items: stretch; }
  .thumb-wrap { flex-basis: auto; width: 100%; }
  .task { gap: 11px; padding: 12px; }
  .task-thumb { flex-basis: 44px; height: 44px; }
}
