:root {
  color-scheme: dark;
  --bg: #070a12;
  --card: rgba(20, 27, 46, .78);
  --card-border: rgba(255, 255, 255, .095);
  --text: #f7f8fc;
  --muted: #9ca8bd;
  --accent: #7c5cff;
  --accent-2: #20d6a3;
  --danger: #ff6680;
  --shadow: 0 22px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 0%, rgba(124, 92, 255, .22), transparent 34rem),
    radial-gradient(circle at 92% 25%, rgba(32, 214, 163, .1), transparent 28rem),
    var(--bg);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }

.shell { width: min(880px, calc(100% - 28px)); margin: 0 auto; padding: 42px 0 28px; }
.brand { display: flex; align-items: center; gap: 16px; margin: 0 4px 28px; }
.logo { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg, var(--accent), #ae5cff); box-shadow: 0 12px 30px rgba(124, 92, 255, .35); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(1.65rem, 4vw, 2.25rem); letter-spacing: -.04em; }
h1 span { color: #a996ff; }
.brand p { margin-bottom: 0; color: var(--muted); }

.card { margin-bottom: 16px; padding: 24px; border: 1px solid var(--card-border); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.hidden { display: none !important; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-head h2 { margin-bottom: 8px; font-size: 1.15rem; }
.eyebrow { margin-bottom: 7px; color: #a996ff; font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.muted, .hint { color: var(--muted); }
.setup.ready { border-color: rgba(32, 214, 163, .35); }
.badge { flex: none; padding: 7px 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: #d9deea; font-size: .76rem; font-weight: 750; }
.badge.accent { color: #cfc4ff; background: rgba(124, 92, 255, .17); }

.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .07); }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
.progress-fill.indeterminate { width: 42%; animation: loading 1.2s ease-in-out infinite alternate; }
@keyframes loading { from { transform: translateX(-95%); } to { transform: translateX(235%); } }

.input-card > label, legend { display: block; margin-bottom: 10px; font-weight: 750; }
.url-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input[type="url"] { min-width: 0; height: 50px; padding: 0 16px; color: var(--text); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; outline: none; background: rgba(4, 7, 14, .7); }
input[type="url"]:focus { border-color: #8e74ff; box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
.hint { margin: 10px 2px 0; font-size: .78rem; }
.platforms { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.platforms span { padding: 6px 9px; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; color: #b5bfd1; font-size: .72rem; background: rgba(255,255,255,.035); }

button { border: 0; border-radius: 13px; font-weight: 800; transition: transform .15s ease, filter .15s ease; }
button:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary { padding: 0 19px; color: white; background: linear-gradient(135deg, var(--accent), #9e61ff); }
.secondary { color: white; border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.07); }
.ghost { padding: 9px 12px; color: #d7ddea; border: 1px solid rgba(255,255,255,.11); background: transparent; }

.preview-grid { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: center; }
.thumb-wrap { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 15px; background: #03050a; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.video-info h2 { margin: 11px 0 7px; line-height: 1.3; }
.video-info p { margin-bottom: 0; }
.divider { height: 1px; margin: 22px 0; background: rgba(255,255,255,.08); }
fieldset { margin: 0; padding: 0; border: 0; }
.quality-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quality { display: flex; align-items: center; gap: 11px; min-height: 67px; padding: 13px; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; background: rgba(255,255,255,.035); cursor: pointer; }
.quality.selected { border-color: rgba(124,92,255,.75); background: rgba(124,92,255,.1); }
.quality input { accent-color: var(--accent); }
.quality span { display: grid; gap: 3px; }
.quality small { color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.action { min-height: 52px; padding: 0 16px; }

.job-card .progress-track { margin-top: 18px; }
.error-card { border-color: rgba(255, 102, 128, .35); background: rgba(94, 20, 38, .35); }
.error-card strong { color: #ff9aae; }
.error-card p { margin: 7px 0 0; color: #f5c4cd; white-space: pre-wrap; }
textarea { width: 100%; min-height: 260px; margin-top: 12px; padding: 16px; resize: vertical; color: var(--text); line-height: 1.6; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; outline: none; background: rgba(4,7,14,.66); }
footer { padding: 8px 12px; text-align: center; color: #768299; font-size: .75rem; }

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 880px); padding-top: 24px; }
  .card { padding: 18px; border-radius: 18px; }
  .url-row, .actions, .quality-grid, .preview-grid { grid-template-columns: 1fr; }
  .url-row .primary { height: 50px; }
  .preview-grid { gap: 14px; }
  .thumb-wrap { width: 100%; }
  .section-head { align-items: center; }
}
