/* FUNX Downloader v8.5.0 — mobile viewport + CTA recovery */
html, body { min-width: 0; }

/* The primary action belongs beside the input, never in a floating bottom bar. */
.page-tiktok .fx-bottom-bar { display: none !important; }

@media (max-width: 760px) {
  body.page-tiktok { padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; }
  .page-tiktok #downloadBtn { display: inline-flex !important; grid-column: 1 / -1 !important; }
  .page-tiktok .fx-support-fab { bottom: max(12px, env(safe-area-inset-bottom)) !important; }
  .page-tiktok .fx-install {
    position: static !important;
    width: calc(100% - 18px) !important;
    margin: 12px auto 0 !important;
  }
}

/* Class-based mirror of the critical mobile layout. This still works when a
   mobile browser restores a desktop-sized CSS viewport and media queries do not fire. */
html.fx-mobile-device,
html.fx-mobile-device body {
  max-width: 100% !important;
  overflow-x: hidden !important;
}
html.fx-mobile-device body.page-tiktok {
  padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
}
html.fx-mobile-device .fx-navlinks,
html.fx-mobile-device .fx-actions .fx-lang,
html.fx-mobile-device .fx-actions .fx-ig {
  display: none !important;
}
html.fx-mobile-device .fx-menu-btn { display: inline-flex !important; }
html.fx-mobile-device .fx-nav {
  width: calc(100% - 16px) !important;
  min-height: 58px !important;
  padding: 8px !important;
  gap: 8px !important;
}
html.fx-mobile-device .fx-brand { min-width: 0 !important; flex: 1 1 auto !important; }
html.fx-mobile-device .fx-brand-title span { display: none !important; }
html.fx-mobile-device .fx-brand-title strong {
  display: block !important;
  max-width: 126px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
html.fx-mobile-device .fx-actions { flex: 0 0 auto !important; gap: 6px !important; }
html.fx-mobile-device .fx-theme-quick,
html.fx-mobile-device .fx-settings-trigger,
html.fx-mobile-device .fx-menu-btn {
  min-width: 42px !important;
  width: auto !important;
  min-height: 42px !important;
  height: 42px !important;
  padding: 0 11px !important;
}
html.fx-mobile-device .fx-theme-quick span { display: none !important; }
html.fx-mobile-device .page-tiktok .container-sm,
html.fx-mobile-device .container,
html.fx-mobile-device .fx-page,
html.fx-mobile-device .home-shell {
  width: calc(100% - 18px) !important;
  max-width: none !important;
  margin-inline: auto !important;
}
html.fx-mobile-device .download-shell { padding: 18px 0 24px !important; }
html.fx-mobile-device .download-layout { display: block !important; grid-template-columns: 1fr !important; }
html.fx-mobile-device .download-intro {
  position: static !important;
  display: block !important;
  width: 100% !important;
  margin: 0 0 12px !important;
  padding: 16px !important;
  border-radius: 20px !important;
}
html.fx-mobile-device .download-intro h1 {
  font-size: clamp(28px, 10vw, 42px) !important;
  line-height: .98 !important;
}
html.fx-mobile-device .download-intro p { font-size: 14px !important; line-height: 1.5 !important; }
html.fx-mobile-device .download-intro__facts {
  width: 100% !important;
  margin-top: 14px !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}
html.fx-mobile-device .download-intro__facts li {
  min-height: 54px !important;
  padding: 10px 12px !important;
  grid-template-columns: 36px minmax(0, 1fr) !important;
}
html.fx-mobile-device .download-intro__actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}
html.fx-mobile-device .download-workspace,
html.fx-mobile-device .tiktok-download-card { width: 100% !important; min-width: 0 !important; }
html.fx-mobile-device .tiktok-download-card { padding: 14px !important; border-radius: 22px !important; }
html.fx-mobile-device .workspace-head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: start !important;
}
html.fx-mobile-device .workspace-head h2 { font-size: clamp(22px, 7vw, 30px) !important; }
html.fx-mobile-device .workspace-status { max-width: 110px !important; margin: 0 !important; }
html.fx-mobile-device .url-input-group {
  width: 100% !important;
  min-width: 0 !important;
  padding: 8px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 8px !important;
}
html.fx-mobile-device .url-input {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  font-size: 16px !important;
}
html.fx-mobile-device .url-input-group .btn,
html.fx-mobile-device .url-input-group .download-button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 52px !important;
  justify-content: center !important;
}
html.fx-mobile-device #pasteBtn .btn-text,
html.fx-mobile-device #clearBtn .btn-text { display: inline !important; }
html.fx-mobile-device #downloadBtn {
  display: inline-flex !important;
  grid-column: 1 / -1 !important;
  order: 4 !important;
  font-size: 15px !important;
}
html.fx-mobile-device .fx-inline-row { align-items: flex-start !important; flex-direction: column !important; }
html.fx-mobile-device .trust-row,
html.fx-mobile-device .fx-first-run__row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}
html.fx-mobile-device .download-secondary-grid,
html.fx-mobile-device .history-items,
html.fx-mobile-device .download-options-grid,
html.fx-mobile-device .download-buttons-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  width: 100% !important;
}
html.fx-mobile-device .tips-box,
html.fx-mobile-device .history-section { padding: 14px !important; border-radius: 20px !important; }
html.fx-mobile-device .history-item {
  width: 100% !important;
  min-width: 0 !important;
  grid-template-columns: 62px minmax(0, 1fr) !important;
}
html.fx-mobile-device .history-content,
html.fx-mobile-device .history-title,
html.fx-mobile-device .history-meta { min-width: 0 !important; overflow-wrap: anywhere !important; }
html.fx-mobile-device .history-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px !important;
}
html.fx-mobile-device .fx-bottom-bar { display: none !important; }
html.fx-mobile-device .fx-support-fab { bottom: max(12px, env(safe-area-inset-bottom)) !important; }
html.fx-mobile-device .fx-footer-inner {
  width: calc(100% - 24px) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
}
html.fx-mobile-device .fx-foot-links { width: 100% !important; }
html.fx-mobile-device .fx-install {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: calc(100% - 18px) !important;
  margin: 12px auto 0 !important;
}

html.fx-mobile-compact .workspace-head { grid-template-columns: 1fr !important; }
html.fx-mobile-compact .workspace-status { max-width: max-content !important; }
html.fx-mobile-narrow .download-intro__actions,
html.fx-mobile-narrow .trust-row,
html.fx-mobile-narrow .fx-first-run__row { grid-template-columns: 1fr !important; }

/* Last-resort correction for a 980px desktop layout viewport on a phone. */
html.fx-viewport-recovery { overflow-x: hidden !important; }
html.fx-viewport-recovery body {
  width: var(--fx-recovery-width) !important;
  max-width: var(--fx-recovery-width) !important;
  min-width: var(--fx-recovery-width) !important;
  margin: 0 !important;
  zoom: var(--fx-recovery-zoom);
}
html.fx-viewport-recovery .fx-header,
html.fx-viewport-recovery .fx-install,
html.fx-viewport-recovery .fx-support-fab { max-width: var(--fx-recovery-width) !important; }
