/* FUNX Downloader v8 — clean responsive design layer */
:root {
  --v8-bg: #080a0f;
  --v8-surface: rgba(18, 21, 29, .88);
  --v8-surface-strong: #141821;
  --v8-surface-soft: rgba(255, 255, 255, .045);
  --v8-border: rgba(255, 255, 255, .10);
  --v8-border-strong: rgba(255, 255, 255, .17);
  --v8-text: #f7f8fb;
  --v8-muted: #a9b0c0;
  --v8-accent: #ff3d71;
  --v8-accent-2: #7c6cff;
  --v8-success: #38d996;
  --v8-warning: #ffca63;
  --v8-danger: #ff667d;
  --v8-radius-sm: 12px;
  --v8-radius: 18px;
  --v8-radius-lg: 26px;
  --v8-shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --v8-page: 1180px;
}

html { color-scheme: dark; scroll-behavior: smooth; }
* { box-sizing: border-box; }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(900px 460px at 0% -10%, rgba(255, 61, 113, .14), transparent 62%),
    radial-gradient(900px 500px at 100% 0%, rgba(124, 108, 255, .13), transparent 58%),
    linear-gradient(180deg, #090b11 0%, #080a0f 100%);
  color: var(--v8-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
body::before, body::after { display: none !important; }
a { color: inherit; }
img, video { max-width: 100%; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid rgba(124, 108, 255, .72) !important;
  outline-offset: 3px;
}

.fx-skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 9999;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  color: #090b11;
  font-weight: 800;
}
.fx-skip-link:focus { transform: translateY(0); }

.fx-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(8, 10, 15, .78);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
.fx-nav {
  width: min(calc(100% - 32px), var(--v8-page));
  min-height: 72px;
  margin: 0 auto;
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 22px;
}
.fx-brand { min-width: 0; gap: 11px; }
.fx-brand-badge {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--v8-accent), var(--v8-accent-2));
  box-shadow: 0 12px 30px rgba(255, 61, 113, .19);
}
.fx-brand-title strong { font-size: 15px; letter-spacing: -.02em; }
.fx-brand-title span { margin-top: 1px; color: var(--v8-muted); font-size: 11px; }
.fx-navlinks { margin-left: auto; gap: 4px; }
.fx-navlinks a {
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--v8-muted);
  font-size: 13px;
  font-weight: 700;
}
.fx-navlinks a:hover, .fx-navlinks a[aria-current="page"] {
  background: rgba(255,255,255,.07);
  color: var(--v8-text);
}
.fx-actions { gap: 8px; }
.fx-lang { padding: 3px; border: 1px solid var(--v8-border); background: rgba(255,255,255,.035); }
.fx-lang button { min-width: 33px; min-height: 31px; color: var(--v8-muted); }
.fx-lang button.active { background: rgba(255,255,255,.1); color: #fff; }
.fx-ig { color: var(--v8-muted); }
.fx-menu-btn { min-width: 44px; min-height: 44px; border-radius: 12px; }
.fx-mobile { background: rgba(8,10,15,.98); }
.fx-mobile-panel { width: min(calc(100% - 32px), var(--v8-page)); padding: 8px 0 18px; }
.fx-mobile-links a { min-height: 48px; border-radius: 12px; }

.container, .fx-page {
  width: min(calc(100% - 32px), var(--v8-page));
  max-width: none;
  margin-inline: auto;
  padding-inline: 0;
}
.container-sm { width: min(calc(100% - 32px), 940px); }
.container > header.flex,
.page-tiktok .container > .flex.justify-between { display: none !important; }

.btn, .download-button {
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 13px;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, opacity .16s ease;
}
.btn:hover, .download-button:hover { transform: translateY(-1px); }
.btn:active, .download-button:active { transform: translateY(0); }
.btn-secondary {
  border: 1px solid var(--v8-border);
  background: rgba(255,255,255,.055);
  color: var(--v8-text);
}
.btn-secondary:hover { border-color: var(--v8-border-strong); background: rgba(255,255,255,.085); }
.btn-primary, .download-button {
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(135deg, var(--v8-accent), var(--v8-accent-2));
  color: #fff;
  box-shadow: 0 14px 34px rgba(255,61,113,.18);
}
.btn[disabled], .download-button[disabled] { opacity: .54; cursor: not-allowed; transform: none; }
.badge { font-weight: 800; letter-spacing: .01em; }

/* Home */
.home-hero {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(72px, 10vw, 128px) 0 72px;
  text-align: center;
}
.home-hero::before {
  content: "PRIVATE • FAST • MOBILE FIRST";
  display: inline-flex;
  margin-bottom: 22px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: #cbd0db;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .12em;
}
.home-hero h1 {
  margin: 0;
  font-size: clamp(43px, 8vw, 78px);
  line-height: .98;
  letter-spacing: -.065em;
  background: linear-gradient(115deg, #fff 18%, #d8d8ff 57%, #ff9ab8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-hero p {
  max-width: 650px;
  margin: 24px auto 30px;
  color: var(--v8-muted) !important;
  font-size: clamp(16px, 2.4vw, 20px);
}
.home-hero .btn { min-height: 54px; padding-inline: 23px; }
section > h2 { margin-top: 18px; letter-spacing: -.035em; }
.platforms-grid {
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.platform-card {
  min-height: 260px;
  padding: 24px;
  border: 1px solid var(--v8-border);
  border-radius: var(--v8-radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.027));
  box-shadow: none;
}
.platform-card:hover { border-color: rgba(255,255,255,.2); transform: translateY(-4px); box-shadow: var(--v8-shadow); }
.platform-icon { font-size: 36px; }
.features-section { padding-top: 92px; }
.features-grid { gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feature-item {
  padding: 22px;
  border: 1px solid var(--v8-border);
  border-radius: var(--v8-radius);
  background: rgba(255,255,255,.032);
  text-align: left;
}
.feature-icon { font-size: 21px; }

/* TikTok workspace */
.page-tiktok .container { padding-top: 42px; }
.tiktok-header {
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}
.tiktok-header h1 { margin: 4px 0 3px; font-size: clamp(28px, 5vw, 44px); letter-spacing: -.045em; }
.tiktok-header p { margin: 0; color: var(--v8-muted) !important; }
.tiktok-download-card {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--v8-border);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(22,25,34,.96), rgba(13,16,23,.94));
  box-shadow: var(--v8-shadow);
}
.tiktok-download-card > h2 { margin-top: 0; font-size: clamp(23px, 3vw, 31px); letter-spacing: -.035em; }
.tiktok-download-card > p { max-width: 650px; }
.url-input-group {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px !important;
  align-items: stretch;
}
.url-input {
  min-width: 0;
  min-height: 54px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(5,7,11,.62);
  color: #fff;
  padding: 0 17px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.url-input::placeholder { color: #737b8d; }
.url-input:focus { border-color: rgba(124,108,255,.78); box-shadow: 0 0 0 4px rgba(124,108,255,.13); }
.url-input-group .btn, .url-input-group .download-button { min-height: 54px; }
.fx-inline-row { margin-top: 12px; }
.fx-chip { border: 1px solid var(--v8-border); background: rgba(255,255,255,.04); }
.fx-inline-hint { color: var(--v8-muted); }
.fx-toggle { margin-top: 18px; }
.fx-first-run {
  margin-top: 22px;
  border: 1px solid rgba(124,108,255,.23);
  border-radius: 18px;
  background: rgba(124,108,255,.07);
}
.fx-first-run__badge { background: rgba(56,217,150,.12); color: #91f3ca; }
.loading-container, .result-container { margin-top: 26px; }
.fx-steps { gap: 8px; }
.fx-step { min-height: 50px; border-radius: 13px; }
.fx-preview-card {
  overflow: hidden;
  border: 1px solid var(--v8-border);
  border-radius: 22px;
  background: rgba(255,255,255,.035);
}
.fx-preview-meta { padding: 20px; }
.fx-caption { max-height: 6.4em; overflow: auto; }
.download-options-grid { gap: 12px; }
.download-option { border-radius: 17px; border-color: var(--v8-border); background: rgba(255,255,255,.04); }
.tips-box, .history-section {
  margin-top: 18px;
  border: 1px solid var(--v8-border);
  border-radius: 22px;
  background: rgba(255,255,255,.028);
}
.fx-tips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.fx-tips li { margin: 0; }
.fx-history-search { min-height: 42px; border-radius: 12px; }
.history-item { border-color: var(--v8-border); border-radius: 16px; background: rgba(255,255,255,.035); }

/* Legal / info pages */
.fx-page { padding-top: 52px; padding-bottom: 70px; }
.fx-hero, .fx-card {
  border-color: var(--v8-border);
  border-radius: 22px;
  background: rgba(255,255,255,.035);
  box-shadow: none;
}
.fx-hero { padding: clamp(24px, 5vw, 46px); }
.fx-hero h1 { letter-spacing: -.045em; }
.fx-card { padding: clamp(20px, 4vw, 30px); }
.fx-grid.two { gap: 16px; }
.fx-footer { border-top-color: var(--v8-border); }
.site-footer { margin-top: 70px; padding-block: 26px 40px; border-top: 1px solid var(--v8-border); color: var(--v8-muted); }

.fx-install {
  border: 1px solid var(--v8-border);
  border-radius: 17px;
  background: rgba(20,24,33,.96);
  box-shadow: var(--v8-shadow);
}
.ig-fab { border: 1px solid var(--v8-border); background: rgba(18,21,29,.9); box-shadow: 0 12px 40px rgba(0,0,0,.24); }
.toast-stack { z-index: 5000; }
.toast { border: 1px solid var(--v8-border); border-radius: 15px; background: rgba(17,20,28,.97); }
.fx-drawer__panel, .fx-modal__panel { background: rgba(13,16,23,.97); border-color: var(--v8-border); box-shadow: var(--v8-shadow); }

.fx-bottom-bar { display: none; }

@media (max-width: 980px) {
  .platforms-grid, .features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .url-input-group { grid-template-columns: minmax(0, 1fr) auto auto; }
  .url-input-group .download-button { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .fx-nav { width: min(calc(100% - 24px), var(--v8-page)); min-height: 64px; }
  .fx-brand-badge { width: 36px; height: 36px; flex-basis: 36px; border-radius: 12px; }
  .fx-brand-title span { display: none; }
  .fx-actions .fx-lang, .fx-actions .fx-ig { display: none; }
  .container, .fx-page, .container-sm { width: min(calc(100% - 24px), var(--v8-page)); }
  .home-hero { padding-top: 62px; padding-bottom: 50px; }
  .home-hero::before { margin-bottom: 17px; font-size: 9px; }
  .platform-card { min-height: 215px; padding: 20px; }
  .features-section { padding-top: 66px; }
  .page-tiktok .container { padding-top: 26px; }
  .tiktok-header { gap: 12px; }
  .tiktok-header > .btn { min-width: 46px; padding-inline: 13px; }
  .tiktok-header > .btn i { margin: 0; }
  .tiktok-download-card { border-radius: 22px; }
  .url-input-group { grid-template-columns: 1fr 1fr; }
  .url-input { grid-column: 1 / -1; }
  .url-input-group .btn { width: 100%; }
  .url-input-group .download-button { display: none; }
  .fx-inline-row { align-items: flex-start; }
  .fx-inline-hint { width: 100%; }
  .fx-first-run__row { display: grid; grid-template-columns: 1fr; }
  .fx-first-run__row .btn { width: 100%; }
  .fx-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fx-step { display: grid; place-items: center; gap: 6px; padding: 10px 5px; text-align: center; }
  .fx-step-text { font-size: 10px; }
  .fx-tips { grid-template-columns: 1fr; }
  .fx-history-head { align-items: stretch; gap: 10px; }
  .fx-history-tools, .fx-history-search { width: 100%; }
  .fx-bottom-bar {
    position: fixed;
    left: 50%;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 120;
    width: min(calc(100% - 20px), 600px);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 48px 48px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 18px;
    background: rgba(12,15,21,.9);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    box-shadow: 0 18px 60px rgba(0,0,0,.45);
  }
  .fx-bottom-bar > .btn, .fx-bottom-bar > .download-button { min-height: 50px; border-radius: 13px; }
  .ig-fab { display: none; }
  .site-footer { margin-top: 48px; }
}

@media (max-width: 520px) {
  .platforms-grid, .features-grid { grid-template-columns: 1fr; }
  .platform-card { min-height: 0; }
  .tiktok-header h1 { font-size: 29px; }
  .tiktok-header p { font-size: 14px; }
  .tiktok-download-card { padding: 19px; }
  .fx-step-text { max-width: 74px; }
  .fx-preview-meta { padding: 16px; }
  .fx-mini-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .fx-mini-actions .btn { width: 100%; justify-content: center; }
  .result-container > .flex { display: grid !important; grid-template-columns: 1fr; }
  .result-container > .flex .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
