:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --panel: #15151d;
  --panel-2: #1d1d28;
  --ink: #f7f5ff;
  --muted: #a7a3b8;
  --line: #30303f;
  --accent: #7c6cff;
  --accent-2: #a89dff;
  --danger: #ff6b7d;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: radial-gradient(circle at 50% -10%, rgba(124,108,255,.18), transparent 36rem), var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1100px, calc(100% - 40px)); min-height: 100vh; margin: auto; display: flex; flex-direction: column; }
.nav { height: 96px; display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); box-shadow: 0 8px 26px rgba(124,108,255,.35); }
.folder-button, .open-result { border: 1px solid var(--line); color: var(--ink); background: rgba(255,255,255,.035); border-radius: 12px; padding: 11px 15px; }
.folder-button:hover, .open-result:hover { border-color: var(--accent-2); background: rgba(124,108,255,.1); }
.hero { flex: 1; width: min(850px, 100%); margin: 66px auto 80px; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 750; }
.eyebrow span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }
h1 { margin: 24px 0 18px; text-align: center; font-size: clamp(3.2rem, 8vw, 6.6rem); line-height: .88; letter-spacing: -.075em; }
h1 em { font-style: normal; color: transparent; -webkit-text-stroke: 1.5px var(--accent-2); }
.intro { max-width: 600px; margin: 0 auto 42px; text-align: center; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.downloader { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(29,29,40,.95), rgba(18,18,25,.98)); border-radius: 24px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.38); }
.source-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 25px; padding: 5px; border: 1px solid #292936; border-radius: 15px; background: #0f0f15; }
.source-tab { border: 0; border-radius: 10px; padding: 12px; color: var(--muted); background: transparent; font-weight: 720; }
.source-tab span { margin-right: 6px; color: var(--accent-2); }
.source-tab.active { color: var(--ink); background: var(--panel-2); box-shadow: 0 4px 18px rgba(0,0,0,.22); }
.source-panel { animation: reveal .2s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
label { display: block; color: #d8d5e5; font-size: .86rem; font-weight: 680; }
.url-row { margin-top: 10px; display: flex; gap: 10px; }
input, select { min-width: 0; border: 1px solid var(--line); outline: none; background: #0f0f15; color: var(--ink); border-radius: 13px; }
input { flex: 1; padding: 16px 18px; font-size: 1rem; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,108,255,.14); }
.analyze, .download { border: 0; color: white; background: var(--accent); border-radius: 13px; font-weight: 760; }
.analyze { min-width: 145px; padding: 0 19px; display: flex; align-items: center; justify-content: space-between; }
.analyze:hover, .download:hover { background: #8c7eff; transform: translateY(-1px); }
.hint { margin: 9px 2px 0; color: #777386; font-size: .78rem; }
.hint.error { color: var(--danger); }
.loading { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { margin-top: 26px; padding-top: 26px; border-top: 1px solid var(--line); }
.search-results { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.results-heading { display: flex; justify-content: space-between; margin-bottom: 12px; color: var(--ink); font-size: .9rem; }
.results-heading span { color: var(--muted); font-size: .8rem; }
.results-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-height: 670px; overflow-y: auto; padding: 1px 7px 1px 1px; scrollbar-color: var(--line) transparent; }
.search-item { position: relative; width: 100%; display: flex; min-width: 0; flex-direction: column; gap: 10px; padding: 8px 8px 12px; border: 1px solid transparent; border-radius: 15px; color: var(--ink); text-align: left; background: rgba(255,255,255,.025); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.search-item:hover, .search-item:focus-visible { transform: translateY(-2px); border-color: rgba(124,108,255,.55); background: rgba(124,108,255,.09); outline: none; }
.search-item img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #09090d; }
.search-item-copy { min-width: 0; }
.search-item-copy strong { display: -webkit-box; min-height: 2.7em; overflow: hidden; color: #ebe9f5; font-size: .88rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.search-item-copy span { display: block; margin-top: 5px; color: var(--muted); font-size: .76rem; }
.choose { margin-top: auto; padding-top: 2px; color: var(--accent-2); font-size: .78rem; font-weight: 750; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; }
.page-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #101016; font-weight: 740; }
.page-button:hover { border-color: var(--accent); color: var(--ink); }
.page-button.active { border-color: var(--accent); color: white; background: var(--accent); box-shadow: 0 7px 20px rgba(124,108,255,.28); }
.media-card { display: grid; grid-template-columns: 140px 1fr; gap: 18px; align-items: center; }
.media-card img { width: 140px; aspect-ratio: 16/9; object-fit: cover; border-radius: 13px; background: #09090d; }
.media-meta span { display: inline-block; color: var(--accent-2); font-size: .78rem; font-weight: 760; }
.media-meta h2 { margin: 6px 0 5px; max-width: 580px; font-size: 1.05rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta p { margin: 0; color: var(--muted); font-size: .87rem; }
.type-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 24px 0 18px; padding: 5px; border-radius: 13px; background: #0f0f15; }
.tab { border: 0; border-radius: 9px; padding: 11px; color: var(--muted); background: transparent; font-weight: 700; }
.tab.active { color: var(--ink); background: var(--panel-2); box-shadow: 0 4px 18px rgba(0,0,0,.22); }
.options { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.options select { width: 100%; margin-top: 8px; padding: 13px 38px 13px 13px; }
.download { padding: 14px 22px; white-space: nowrap; }
.progress-card { margin-top: 24px; padding: 18px; border: 1px solid rgba(124,108,255,.35); border-radius: 16px; background: rgba(124,108,255,.07); }
.progress-copy { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 11px; font-size: .9rem; }
.progress-copy span { color: var(--accent-2); }
.progress-track { height: 8px; overflow: hidden; border-radius: 20px; background: #0b0b10; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #b6adff); transition: width .35s ease; }
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.save-device { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 11px; color: #fff; background: var(--accent); text-decoration: none; font-weight: 750; }
.save-device:hover { background: #8c7eff; }
.open-result { margin-top: 0; }
footer { min-height: 76px; border-top: 1px solid #20202a; display: flex; align-items: center; justify-content: space-between; color: #777386; font-size: .78rem; }
footer strong { color: #aaa6ba; }
.hidden { display: none !important; }

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1100px); }
  .nav { height: 74px; }
  .folder-button { font-size: .8rem; }
  .hero { margin: 40px auto 50px; }
  h1 { font-size: clamp(3rem, 17vw, 5rem); }
  .intro { font-size: 1rem; }
  .downloader { padding: 18px; border-radius: 18px; }
  .url-row { display: grid; }
  .analyze { min-height: 50px; width: 100%; }
  .media-card { grid-template-columns: 96px 1fr; }
  .media-card img { width: 96px; }
  .options { grid-template-columns: 1fr 1fr; }
  .download { grid-column: 1 / -1; min-height: 50px; }
  .source-tab { padding: 11px 7px; font-size: .82rem; }
  .results-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 620px; }
  .search-item { padding: 6px 6px 10px; }
  .search-item-copy strong { font-size: .8rem; }
  .search-item-copy span { font-size: .7rem; }
  .choose { display: none; }
  footer { padding: 20px 0; gap: 12px; align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .results-list { grid-template-columns: 1fr; }
  .search-item { display: grid; grid-template-columns: 108px minmax(0,1fr); align-items: center; }
  .search-item img { width: 108px; }
}
