/* vidloader — тёмная тема, современный минимализм */

:root {
  --bg: #08090d;
  --bg-soft: #0e1017;
  --card: rgba(21, 24, 33, 0.72);
  --card-solid: #151821;
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f6;
  --muted: #8d93a6;
  --accent: #7c6cff;
  --accent-2: #4dd0ff;
  --ok: #37e0a0;
  --err: #ff6b6b;
  --radius: 18px;
  --radius-sm: 12px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Мягкое цветное свечение на фоне */
.glow {
  position: fixed;
  inset: -30% -10% auto;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 22% 0%, rgba(124, 108, 255, 0.20), transparent 70%),
    radial-gradient(40% 50% at 82% 8%, rgba(77, 208, 255, 0.13), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Шапка ---------- */

.topbar {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
}
.brand svg { width: 26px; height: 26px; }

.badge {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

/* ---------- Каркас ---------- */

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 22px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 38px 0 6px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -1.2px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: 14px;
  max-width: 46ch;
  margin-inline: auto;
}

/* ---------- Карточки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

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

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
}

/* ---------- Поле ввода ---------- */

.search-card form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  width: 19px;
  height: 19px;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s;
}

.field:focus-within .field-icon { color: var(--accent); }

input[type="text"] {
  width: 100%;
  padding: 14px 14px 14px 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-strong);
  background: rgba(8, 9, 13, 0.75);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input[type="text"]::placeholder { color: var(--muted); }
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18);
}

/* ---------- Кнопки ---------- */

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--accent), #6a5cf0);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 22px rgba(124, 108, 255, 0.32);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 8px 28px rgba(124, 108, 255, 0.42);
}
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.65; cursor: default; }

.btn-primary.wide { width: 100%; margin-top: 16px; padding: 15px; font-size: 15.5px; }
.btn-primary.wide svg { width: 19px; height: 19px; }

.btn-ghost {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--stroke-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.22); }
.btn-ghost.danger { color: #ff9d9d; }
.btn-ghost.danger:hover { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.35); }

.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.loading .spinner { display: block; }
.btn-primary.loading .btn-label { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-2);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.link-btn:hover { opacity: 1; text-decoration: underline; }

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

/* ---------- Подсказки / панель cookies ---------- */

.under-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.panel {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(8, 9, 13, 0.6);
  border: 1px solid var(--stroke);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.panel-note { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.panel-note.small { font-size: 11.5px; }

.panel textarea {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--stroke-strong);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
}
.panel textarea:focus { border-color: var(--accent); }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.panel-actions .panel-note { flex: 1; min-width: 180px; margin: 0; }

/* ---------- Ошибка ---------- */

.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 107, 107, 0.09);
  border: 1px solid rgba(255, 107, 107, 0.32);
  color: #ffb3b3;
  font-size: 13.5px;
  line-height: 1.45;
}

/* ---------- Результат ---------- */

.result-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: start;
}

.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--stroke);
}
.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.duration[hidden] { display: none; }

.result-body { min-width: 0; }

.result-body h2 {
  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;
}

.meta { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

/* ---------- Форматы ---------- */

.formats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.fmt {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.fmt:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--stroke-strong); }
.fmt:active { transform: scale(0.98); }

.fmt-q { font-size: 13.5px; font-weight: 650; line-height: 1.15; }
.fmt-s { font-size: 10.5px; color: var(--muted); line-height: 1.2; }

.fmt.active {
  border-color: var(--accent);
  background: rgba(124, 108, 255, 0.14);
  box-shadow: 0 0 0 1px rgba(124, 108, 255, 0.35) inset;
}
.fmt.active .fmt-q { color: #c7bdff; }
.fmt.active .fmt-s { color: #a79af0; }

/* ---------- Прогресс ---------- */

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.pct {
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 700;
}

.bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-top: 12px;
}

#barFill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-foot .link-btn { color: #ff9d9d; }
.progress-foot .link-btn:hover { color: #ffb3b3; }

/* ---------- Готово ---------- */

.done-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border-color: rgba(55, 224, 160, 0.28);
  background: rgba(55, 224, 160, 0.06);
}
.done-card strong { font-size: 14px; font-weight: 650; word-break: break-word; }

.check {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(55, 224, 160, 0.16);
  border: 1px solid rgba(55, 224, 160, 0.4);
  color: var(--ok);
  font-size: 19px;
  font-weight: 700;
}

/* ---------- Подвал ---------- */

footer {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  padding-top: 12px;
  opacity: 0.75;
}

/* ---------- Адаптив ---------- */

@media (max-width: 620px) {
  .wrap, .topbar { padding-left: 16px; padding-right: 16px; }

  .search-card form { flex-direction: column; }
  .btn-primary { width: 100%; }

  .result-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .thumb-wrap { max-width: 100%; }

  .hero { padding-top: 28px; }
  .under-row { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 400px) {
  .card { padding: 16px; }
  .fmt { padding: 7px 10px; }
}
