@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #080b12;
  --bg-soft: #0d111b;
  --surface: #121722;
  --surface-raised: #171d2a;
  --surface-hover: #1c2433;
  --line: #273043;
  --line-soft: #1d2534;
  --text: #f7f8fb;
  --text-soft: #a7b0c0;
  --text-dim: #778196;
  --accent: #ff5c35;
  --accent-hover: #ff7554;
  --accent-soft: rgba(255, 92, 53, 0.13);
  --blue: #60a5fa;
  --green: #35d49a;
  --yellow: #f4be55;
  --danger: #ff7184;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 74% -10%, rgba(255, 92, 53, 0.09), transparent 28rem),
    radial-gradient(circle at 5% 30%, rgba(65, 103, 178, 0.08), transparent 25rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
button, input { font: inherit; }
button { touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.65);
  outline-offset: 3px;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-mark svg { fill: currentColor; stroke: none; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  left: 16px;
  top: -70px;
  z-index: 100;
  padding: 12px 18px;
  color: var(--text);
  background: var(--accent);
  border-radius: 8px;
  transition: top 180ms ease;
}
.skip-link:focus { top: 16px; }
.site-header {
  max-width: 1240px;
  margin: 0 auto;
  height: 88px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand strong { color: var(--accent); font-weight: 700; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 11px;
  box-shadow: 0 8px 25px rgba(255, 92, 53, 0.22);
}
.brand-mark svg { width: 19px; height: 19px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
}
.server-status > span {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(53, 212, 154, 0.1);
}
.ghost-button, .icon-button {
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  background: rgba(18, 23, 34, 0.75);
  border-radius: 11px;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}
.ghost-button {
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ghost-button svg { width: 17px; height: 17px; }
.ghost-button:hover, .icon-button:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: #3a455b;
}
.hero {
  max-width: 1040px;
  margin: 0 auto;
  padding: 88px 28px 64px;
  text-align: center;
}
.hero-copy { max-width: 820px; margin: 0 auto; }
.eyebrow {
  margin: 0 0 17px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #d8a99d;
}
.hero .eyebrow > span { width: 17px; height: 1px; background: var(--accent); }
h1, h2, h3 { font-family: "Manrope", sans-serif; }
.hero h1 {
  margin: 0;
  font-size: clamp(42px, 6.2vw, 74px);
  line-height: 1.05;
  letter-spacing: -0.055em;
  font-weight: 700;
}
.hero h1 em {
  color: var(--text-dim);
  font-style: normal;
  font-weight: 600;
}
.hero-copy > p:last-child {
  max-width: 630px;
  margin: 27px auto 0;
  color: var(--text-soft);
  font-size: 18px;
}
.url-card {
  margin: 48px auto 0;
  padding: 18px;
  text-align: left;
  background: rgba(18, 23, 34, 0.92);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.url-card > label, .login-card label {
  display: block;
  margin: 0 0 9px 3px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}
.url-row { display: flex; gap: 10px; }
.url-input-wrap, .password-wrap { position: relative; flex: 1; }
.url-input-wrap > svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 19px;
  height: 19px;
  color: var(--text-dim);
  transform: translateY(-50%);
  pointer-events: none;
}
input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  color: var(--text);
  background: #0d121d;
  border: 1px solid #293246;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.url-input-wrap input { padding-left: 47px; }
input::placeholder { color: #667085; }
input:hover { border-color: #39445a; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1); outline: none; }
.primary-button {
  min-height: 52px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 92, 53, 0.18);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.primary-button:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 10px 28px rgba(255, 92, 53, 0.26); }
.primary-button:active:not(:disabled) { transform: scale(0.98); }
.primary-button:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }
.primary-button svg { width: 18px; height: 18px; }
.primary-button.loading span { opacity: 0.78; }
.primary-button.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.primary-button.loading svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.helper-text { margin: 10px 3px 0; color: var(--text-dim); font-size: 12px; }
.field-error { min-height: 0; margin: 9px 3px 0; color: var(--danger); font-size: 13px; }
.field-error:empty { display: none; }
.workspace { max-width: 1040px; margin: 0 auto; padding: 0 28px 72px; }
.video-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: panel-in 280ms ease-out both;
}
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); } }
.video-summary {
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line-soft);
}
.video-summary img {
  width: 180px;
  height: 102px;
  object-fit: cover;
  background: var(--bg-soft);
  border-radius: 12px;
}
.video-details { min-width: 0; text-align: left; }
.summary-label {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}
.video-details h2 {
  margin: 7px 0 5px;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-details p { margin: 0; color: var(--text-dim); font-size: 13px; }
.dot { margin: 0 7px; }
.format-tabs {
  display: flex;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
}
.format-tab {
  min-height: 56px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: color 180ms ease, border-color 180ms ease;
}
.format-tab:hover { color: var(--text); }
.format-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.format-tab svg { width: 18px; height: 18px; }
.format-content { padding: 24px 22px 26px; }
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.section-heading h3 { margin: 0; font-size: 17px; }
.section-heading p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.quality-count {
  padding: 5px 9px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border-radius: 7px;
  font-size: 11px;
}
.quality-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.quality-option {
  position: relative;
  min-height: 74px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  color: var(--text);
  text-align: left;
  background: #0e131e;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.quality-option:hover { background: var(--surface-hover); border-color: #414c61; }
.quality-option.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 92, 53, .16);
}
.quality-option strong { font-size: 14px; }
.quality-option span { margin-top: 3px; color: var(--text-dim); font-size: 11px; }
.quality-option.selected::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.download-cta {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #0e131e;
  border-top: 1px solid var(--line-soft);
}
.download-cta > div { display: flex; flex-direction: column; }
.download-cta > div span { color: var(--text-dim); font-size: 11px; }
.download-cta > div strong { margin-top: 2px; font-size: 14px; }
.downloads-section { margin-top: 70px; }
.downloads-heading { align-items: flex-end; }
.downloads-heading .eyebrow { margin-bottom: 7px; }
.downloads-heading h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.downloads-list { margin-top: 20px; display: grid; gap: 10px; }
.download-item {
  position: relative;
  overflow: hidden;
  padding: 15px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 15px;
}
.download-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  background: var(--bg-soft);
  border-radius: 8px;
}
.download-info { min-width: 0; }
.download-info h3 {
  margin: 0 0 5px;
  overflow: hidden;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.download-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 11px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-soft);
}
.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}
.status-completed { color: var(--green); }
.status-failed { color: var(--danger); }
.status-downloading, .status-processing { color: var(--blue); }
.status-queued { color: var(--yellow); }
.progress-track {
  height: 3px;
  margin-top: 10px;
  overflow: hidden;
  background: #242c3b;
  border-radius: 9px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 400ms ease;
}
.download-actions { display: flex; align-items: center; gap: 8px; }
.download-actions .ghost-button { min-height: 42px; font-size: 12px; text-decoration: none; }
.download-actions .danger-action { width: 42px; padding: 0; color: var(--text-dim); }
.download-actions .danger-action:hover { color: var(--danger); }
.item-error { margin: 6px 0 0; color: var(--danger); font-size: 11px; white-space: normal; }
.empty-state {
  margin-top: 20px;
  padding: 52px 24px;
  text-align: center;
  background: rgba(18, 23, 34, 0.5);
  border: 1px dashed #2b3548;
  border-radius: var(--radius-md);
}
.empty-state > span {
  width: 50px;
  height: 50px;
  margin: 0 auto 15px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { max-width: 480px; margin: 7px auto 0; color: var(--text-dim); font-size: 13px; }
.reliability-note {
  margin-top: 24px;
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  color: var(--text-soft);
  background: rgba(96, 165, 250, .055);
  border: 1px solid rgba(96, 165, 250, .16);
  border-radius: 13px;
}
.reliability-note > svg { flex: 0 0 auto; color: var(--blue); }
.reliability-note strong { color: var(--text); font-size: 13px; }
.reliability-note p { margin: 3px 0 0; font-size: 12px; }
.youtube-access {
  margin-top: 14px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 15px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
}
.youtube-access-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 11px;
}
.youtube-access-icon svg { width: 21px; height: 21px; }
.cookie-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.youtube-access h2 { margin: 0; font-size: 14px; }
.youtube-access p { max-width: 650px; margin: 5px 0 0; color: var(--text-dim); font-size: 12px; }
.youtube-access code { color: var(--text-soft); }
.youtube-access details { margin-top: 8px; color: var(--text-soft); font-size: 12px; }
.youtube-access summary { cursor: pointer; }
.youtube-access ol { margin: 8px 0 0; padding-left: 18px; color: var(--text-dim); }
.cookie-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 10px;
}
.cookie-status > span { width: 6px; height: 6px; background: var(--yellow); border-radius: 50%; }
.cookie-status.connected { color: var(--green); }
.cookie-status.connected > span { background: var(--green); }
.cookie-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.cookie-actions .ghost-button { font-size: 12px; white-space: nowrap; }
.text-button {
  padding: 7px;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  font-size: 11px;
  cursor: pointer;
}
.text-button:hover { color: var(--danger); }
footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 25px 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-dim);
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 44px));
  padding: 13px 16px;
  color: var(--text);
  background: #222b3a;
  border: 1px solid #39445a;
  border-radius: 11px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: 100%; max-width: 430px; }
.login-card {
  padding: 38px;
  background: rgba(18, 23, 34, .95);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.login-card > .brand-mark { width: 46px; height: 46px; margin-bottom: 25px; }
.login-card > .eyebrow { margin-bottom: 9px; color: #d8a99d; }
.login-card h1 { margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: -.04em; }
.login-copy { margin: 13px 0 27px; color: var(--text-soft); }
.password-wrap input { padding-right: 54px; }
.icon-button {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border-color: transparent;
}
.full-width { width: 100%; margin-top: 15px; }
.privacy-note {
  margin: 23px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 11px;
}
.privacy-note svg { width: 15px; height: 15px; }

@media (max-width: 760px) {
  .site-header { height: 72px; padding: 0 18px; }
  .server-status { display: none; }
  .ghost-button span { display: none; }
  .hero { padding: 62px 18px 48px; }
  .hero h1 { font-size: clamp(38px, 12vw, 54px); }
  .hero-copy > p:last-child { font-size: 16px; }
  .url-row { flex-direction: column; }
  .url-card { margin-top: 35px; padding: 14px; }
  .url-card .primary-button { width: 100%; }
  .workspace { padding: 0 18px 52px; }
  .video-summary { align-items: flex-start; }
  .video-summary img { width: 116px; height: 68px; }
  .video-details h2 { font-size: 16px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .quality-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .download-cta { align-items: stretch; flex-direction: column; }
  .download-cta .primary-button { width: 100%; }
  .downloads-section { margin-top: 50px; }
  .download-item { grid-template-columns: 58px minmax(0, 1fr); }
  .download-thumb { width: 58px; height: 42px; }
  .download-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .youtube-access { grid-template-columns: auto 1fr; }
  .cookie-actions { grid-column: 1 / -1; justify-content: stretch; }
  .cookie-actions .ghost-button { flex: 1; }
  footer { padding: 22px 18px; flex-direction: column; }
}
@media (max-width: 420px) {
  .header-actions .ghost-button { width: 44px; padding: 0; }
  .hero { padding-top: 50px; }
  .hero h1 { font-size: 38px; }
  .hero-copy > p:last-child { font-size: 15px; }
  .video-summary { padding: 16px; gap: 13px; }
  .video-summary img { width: 92px; height: 58px; }
  .format-tabs, .format-content { padding-left: 16px; padding-right: 16px; }
  .format-tab { flex: 1; padding: 0 8px; justify-content: center; font-size: 13px; }
  .quality-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
