:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: rgba(17, 29, 48, .86);
  --panel-2: #12213a;
  --line: rgba(148, 173, 211, .16);
  --text: #edf4ff;
  --muted: #93a6c2;
  --accent: #5dd6c0;
  --accent-2: #78a7ff;
  --danger: #ff7f91;
  --warning: #ffc66d;
  --success: #6ee7a8;
  --shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(93, 214, 192, .15), transparent 32%),
    radial-gradient(circle at 90% 0%, rgba(120, 167, 255, .18), transparent 28%),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 70px; }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; margin-bottom: 28px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 800; }
h1 { margin: 4px 0 6px; font-size: clamp(36px, 6vw, 68px); line-height: .95; letter-spacing: -.05em; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
p { color: var(--muted); max-width: 720px; margin: 12px 0 0; }
.live-indicator { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(8,17,31,.7); white-space: nowrap; }
.live-indicator span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px var(--success); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; background: rgba(12, 24, 41, .7); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.stat strong { display: block; font-size: 28px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.danger strong { color: var(--danger); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel, .queue-section { border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.panel { padding: 24px; }
.panel-head, .queue-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.panel-head > div { display: flex; align-items: center; gap: 12px; }
.step { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(93,214,192,.12); color: var(--accent); font-size: 12px; font-weight: 800; }
.hint, .format-help { color: var(--muted); font-size: 12px; }
.dropzone { min-height: 190px; border: 1px dashed rgba(120,167,255,.45); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: rgba(120,167,255,.05); transition: .2s ease; text-align: center; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(93,214,192,.08); transform: translateY(-1px); }
.dropzone input { display: none; }
.upload-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 10px; border-radius: 16px; background: linear-gradient(135deg, rgba(93,214,192,.2), rgba(120,167,255,.2)); color: var(--accent); font-size: 28px; }
.dropzone span { color: var(--muted); margin-top: 4px; }
textarea { width: 100%; resize: vertical; min-height: 190px; border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px; color: var(--text); background: rgba(7,15,28,.65); outline: none; }
textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(120,167,255,.1); }
code { color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); margin: 14px 0; user-select: none; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.primary, .secondary, .action-btn { border: 0; border-radius: 12px; padding: 11px 16px; color: #07131f; background: linear-gradient(135deg, var(--accent), #80e8d2); font-weight: 800; }
.primary { width: 100%; }
.secondary { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.queue-section { margin-top: 20px; padding: 24px; }
.queue-head { align-items: flex-end; }
.queue-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,15,28,.55); }
.filters button { border: 0; border-radius: 9px; padding: 7px 10px; color: var(--muted); background: transparent; }
.filters button.active { color: var(--text); background: var(--panel-2); }
.task-list { display: grid; gap: 10px; }
.task { display: grid; grid-template-columns: minmax(250px, 1.6fr) minmax(220px, 1fr) minmax(180px, .7fr) auto; gap: 18px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: rgba(7,15,28,.48); }
.task-title { display: flex; gap: 12px; min-width: 0; }
.kind-icon { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: rgba(120,167,255,.12); color: var(--accent-2); font-weight: 900; }
.kind-icon.rutube { color: #ff8fa0; background: rgba(255,127,145,.1); }
.kind-icon.direct { color: var(--accent); background: rgba(93,214,192,.1); }
.task-title strong, .source { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task-title small, .source { color: var(--muted); }
.task-title small { display: block; margin-top: 3px; }
.progress-wrap { min-width: 0; }
.progress-top { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.progress { height: 8px; border-radius: 999px; background: #091426; overflow: hidden; }
.progress > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .35s ease; }
.status { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: rgba(148,173,211,.1); color: var(--muted); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.completed { color: var(--success); background: rgba(110,231,168,.1); }
.status.failed { color: var(--danger); background: rgba(255,127,145,.1); }
.status.downloading, .status.running, .status.parsing, .status.extracting { color: var(--accent-2); background: rgba(120,167,255,.1); }
.status.queued, .status.waiting { color: var(--warning); background: rgba(255,198,109,.1); }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.action-btn { padding: 7px 10px; font-size: 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.action-btn.danger { color: var(--danger); }
.action-btn.success { color: var(--success); }
.task-message { grid-column: 1 / -1; color: var(--muted); font-size: 12px; padding-left: 54px; overflow-wrap: anywhere; }
.task-message.error { color: var(--danger); }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 17px; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 10px; }
.toast { max-width: 420px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #14233b; box-shadow: var(--shadow); }
.toast.error { border-color: rgba(255,127,145,.4); }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.66); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(720px, 100%); max-height: 80vh; overflow: auto; border: 1px solid var(--line); border-radius: 22px; padding: 20px; background: #101e34; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head button { border: 0; color: var(--muted); background: transparent; font-size: 28px; }
.files-list { display: grid; gap: 8px; margin-top: 16px; }
.file-link { display: flex; justify-content: space-between; gap: 15px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; background: rgba(7,15,28,.45); }
.file-link span:last-child { color: var(--muted); white-space: nowrap; }
@media (max-width: 1050px) { .stats { grid-template-columns: repeat(3,1fr); } .grid { grid-template-columns: 1fr; } .task { grid-template-columns: 1fr 1fr; } .actions { justify-content: flex-start; } }
@media (max-width: 700px) { .shell { width: min(100% - 22px, 1480px); padding-top: 24px; } .hero, .queue-head { align-items: stretch; flex-direction: column; } .live-indicator { align-self: flex-start; } .stats { grid-template-columns: repeat(2,1fr); } .task { grid-template-columns: 1fr; } .task-message { padding-left: 0; } .queue-actions { justify-content: flex-start; } }
