:root,
[data-theme='dark'] {
  --bg: #0a0b12;
  --surface: #12131c;
  --surface-2: #1a1b27;
  --stroke: #262838;
  --text: #f5f6fb;
  --muted: #9497ae;
  --primary: #6d5bff;
  --secondary: #14c8e6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gradient: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, var(--secondary)), var(--secondary));
  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --stroke: #e3e5ef;
  --text: #0e0f1a;
  --muted: #646880;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.glow {
  position: fixed;
  inset: -20% -10% auto;
  height: 70vh;
  pointer-events: none;
  background:
    radial-gradient(closest-side at 25% 40%, color-mix(in srgb, var(--primary) 30%, transparent), transparent),
    radial-gradient(closest-side at 80% 30%, color-mix(in srgb, var(--secondary) 22%, transparent), transparent);
  filter: blur(10px);
  z-index: -1;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }

.top, .page, .foot { width: min(720px, 100%); margin: 0 auto; padding-left: 16px; padding-right: 16px; }

.top { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; font-weight: 800; font-size: 20px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--stroke);
  background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer;
}

.hero { padding: 40px 0 24px; }
.hero h1 { margin: 0 0 12px; font-size: clamp(32px, 7vw, 52px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; }
.grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--surface); border: 1px solid var(--stroke); border-radius: 24px; }
.input-card { display: grid; gap: 12px; padding: 14px; }

.input-row { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 16px; padding: 6px 6px 6px 16px; border: 1.5px solid transparent; }
.input-row:focus-within { border-color: var(--primary); }
textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent;
  color: var(--text); font: inherit; padding: 10px 0; max-height: 140px;
}

.pill {
  border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer; font-weight: 700; font-size: 13px; line-height: 1; font-family: inherit;
  background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary);
}

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 16px; }
.segmented button {
  border: 0; border-radius: 12px; padding: 11px; font-weight: 700; font-size: 14px; line-height: 1; font-family: inherit;
  background: transparent; color: var(--muted); cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 3px 10px rgb(0 0 0 / 0.12); }
[data-theme='dark'] .segmented button.active { background: var(--stroke); }

.cta {
  border: 0; border-radius: 16px; min-height: 54px; padding: 0 22px; width: 100%;
  background: var(--gradient); color: #fff; font-weight: 800; font-size: 16px; line-height: 1; font-family: inherit; cursor: pointer;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 30%, transparent);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.cta:hover { filter: brightness(1.07); }
.cta:active { transform: scale(0.99); }
.cta:disabled { opacity: 0.6; cursor: progress; }

.notice { margin-bottom: 14px; padding: 12px 14px; border-radius: 14px; font-weight: 600; font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.notice.error { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.results { display: grid; gap: 14px; margin-top: 22px; }

.media { overflow: hidden; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--gradient); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb img:not([src]), .thumb img[src=''] { display: none; }
.duration, .platform {
  position: absolute; padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 700;
  background: rgb(0 0 0 / 0.62); color: #fff;
}
.duration { right: 12px; bottom: 12px; }
.platform { left: 12px; top: 12px; }
.duration:empty, .platform:empty { display: none; }

.media-body { padding: 16px; display: grid; gap: 12px; }
.title { margin: 0; font-size: 17px; line-height: 1.35; }
.meta { margin: -6px 0 0; font-size: 13px; }

.qualities { display: flex; gap: 8px; flex-wrap: wrap; }
.qualities:empty { display: none; }
.quality {
  border: 1.5px solid transparent; border-radius: 12px; padding: 8px 12px; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13px; line-height: 1; font-family: inherit;
}
.quality small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.quality.active { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }

.progress-head, .progress-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; }
.bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--gradient); border-radius: 8px; transition: width 0.4s ease; }
.bar.indeterminate span { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.link { border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 13px; line-height: 1; font-family: inherit; cursor: pointer; }
.link:hover { color: var(--text); }
.error { margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }

.done-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.done-actions a { flex: 1; text-align: center; text-decoration: none; display: grid; place-items: center; }

.platforms { margin-top: 28px; }
.platforms h2 { font-size: 15px; margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--stroke); font-size: 13px; font-weight: 700; }

.foot { padding-top: 36px; padding-bottom: 36px; font-size: 12.5px; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
