/* YtDown — styles */
:root {
  --bg: #07070a;
  --surface: #101016;
  --surface-2: #17171f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f3f7;
  --muted: #9b9baa;
  --accent: #ff2d4b;
  --accent-soft: rgba(255, 45, 75, 0.14);
  --accent-2: #ff7a45;
  --ok: #35d07f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

.glow {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 50% 10%, rgba(255, 45, 75, 0.18), transparent 70%),
    radial-gradient(35% 45% at 78% 0%, rgba(255, 122, 69, 0.10), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 4vw, 40px);
  background: rgba(7, 7, 10, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.22rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.brand-mark img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
}

.brand-fallback { width: 40px; height: 40px; }

.brand-name span { color: var(--accent); }

.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.topnav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

main {
  position: relative;
  z-index: 1;
  width: min(100% - 36px, 980px);
  margin: 0 auto;
  padding: clamp(34px, 7vw, 76px) 0 40px;
}

.hero { text-align: center; }

.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 14px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 45, 75, 0.28);
  border-radius: 999px;
}

h1 {
  margin: 0 auto 14px;
  font-size: clamp(2rem, 5.4vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 800;
  max-width: 16ch;
}

h1 .accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 0 auto 30px;
  max-width: 44ch;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 8px 8px 8px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.searchbar:focus-within {
  border-color: rgba(255, 45, 75, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 45, 75, 0.12), var(--shadow);
}

.search-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.searchbar input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 4px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.searchbar input::placeholder { color: #6c6c7c; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(100deg, var(--accent), #ff4b5f);
  box-shadow: 0 10px 26px -12px rgba(255, 45, 75, 0.9);
}

.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 30px -12px rgba(255, 45, 75, 0.95); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: #1e1e29; }

.btn-lg { width: 100%; padding: 14px 22px; font-size: 1rem; margin-top: 18px; }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn.is-loading .btn-label { opacity: 0.85; }

.status {
  min-height: 1.4em;
  margin: 16px auto 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.92rem;
}

.status.is-error { color: #ff8090; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.result {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 30px);
  margin-top: clamp(28px, 5vw, 46px);
  padding: clamp(18px, 3vw, 26px);
  animation: rise 0.35s ease both;
}

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

.media {
  position: relative;
  align-self: start;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #1a1a22;
  aspect-ratio: 16 / 9;
}

.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-variant-numeric: tabular-nums;
}

.meta { min-width: 0; display: flex; flex-direction: column; }

.meta h2 {
  margin: 0 0 6px;
  font-size: clamp(1.1rem, 2.4vw, 1.42rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.channel {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dot { margin: 0 7px; opacity: 0.6; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tab {
  padding: 9px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab small {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.75;
  margin-left: 4px;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: #fff;
  background: linear-gradient(100deg, var(--accent), #ff4b5f);
  box-shadow: 0 8px 20px -12px rgba(255, 45, 75, 0.9);
}

.quality-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hint { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 0.8rem; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.chip span { font-size: 0.7rem; font-weight: 500; color: var(--muted); }

.chip:hover { border-color: rgba(255, 255, 255, 0.3); transform: translateY(-1px); }

.chip.is-active {
  border-color: rgba(255, 45, 75, 0.75);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(255, 45, 75, 0.1);
}

.chip.is-active span { color: #ffb3bd; }

.audio-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.progress-card {
  margin-top: 20px;
  padding: clamp(18px, 3vw, 24px);
  animation: rise 0.3s ease both;
}

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

.progress-head #progressTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pct {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--accent);
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.bar.is-indeterminate .bar-fill {
  width: 35% !important;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(310%); }
}

.detail {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.detail.is-error { color: #ff8090; }
.detail.is-ok { color: var(--ok); }

.done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.faq {
  margin-top: clamp(46px, 8vw, 76px);
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.faq h2 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  font-size: 1.15rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.faq details[open] summary::after { transform: rotate(45deg); }

.faq details p {
  margin: 10px 0 2px;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 72ch;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 28px 18px 40px;
  color: #6f6f80;
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 720px) {
  .result { grid-template-columns: 1fr; }
  .media { max-height: 240px; }
  .searchbar { flex-wrap: wrap; border-radius: 18px; padding: 10px; gap: 10px; }
  .searchbar input { flex: 1 1 100%; padding: 6px 4px; }
  .searchbar .search-icon { display: none; }
  .searchbar .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
