/* FUNX Downloader v8.7.1 — UI cleanup, language selector, layout audit */

/* Language visibility is finalized by site.js. Before JS runs, keep only the
   language selected by the preflight. Minang deliberately falls back to ID
   until JS can resolve per-group Minang copy. */
html[data-fx-lang="id"] [data-lang="en"],
html[data-fx-lang="id"] [data-lang="min"],
html[data-fx-lang="en"] [data-lang="id"],
html[data-fx-lang="en"] [data-lang="min"] { display:none!important; }

:root { --fx-page: 1440px; }

/* Header language control */
.fx-lang-picker{
  position:relative; display:inline-flex; align-items:center; min-width:88px;
  height:40px; border:1px solid var(--fx-line-strong); border-radius:12px;
  background:var(--fx-card); color:var(--fx-ink); overflow:hidden;
}
.fx-lang-picker::before{
  content:""; width:6px; height:6px; border-radius:50%; background:var(--fx-success);
  margin-left:11px; flex:0 0 auto;
}
.fx-lang-select{
  appearance:none; -webkit-appearance:none; border:0!important; outline:0!important;
  width:100%; min-width:0; height:100%; padding:0 24px 0 7px!important;
  background:transparent!important; color:var(--fx-ink)!important;
  font-family:var(--fx-mono); font-size:10px; font-weight:800; letter-spacing:.06em;
  cursor:pointer; box-shadow:none!important;
}
.fx-lang-picker::after{content:"⌄";position:absolute;right:8px;top:50%;transform:translateY(-54%);pointer-events:none;color:var(--fx-muted);font-size:12px}
.fx-lang-select option{background:var(--fx-card);color:var(--fx-ink)}

/* Home — use the desktop canvas better and reduce empty bands. */
.home-shell{width:min(calc(100% - 48px),var(--fx-page))!important}
.home-hero{
  padding:clamp(58px,7vw,92px) 0 clamp(52px,6vw,76px)!important;
  grid-template-columns:minmax(0,1.05fr) minmax(360px,.95fr)!important;
  gap:clamp(34px,5vw,72px)!important;
}
.home-hero h1{font-size:clamp(50px,6.5vw,82px)!important}
.home-section,.features-section{padding:clamp(52px,5.5vw,72px) 0!important}
.section-head{margin-bottom:28px!important;gap:28px!important}
.platform-card{min-height:240px!important;padding:22px!important}
.feature-item{min-height:190px!important;padding:22px!important}
.feature-item h4{margin-top:30px!important}
.home-cta{padding:clamp(52px,6vw,76px) 0!important;gap:24px!important}

/* TikTok form — desktop actions in one clean row; mobile remains stacked. */
.page-tiktok .container-sm{width:min(calc(100% - 48px),var(--fx-page))!important}
.download-shell{padding:clamp(42px,5vw,68px) 0 56px!important}
.download-layout{grid-template-columns:minmax(260px,.72fr) minmax(0,1.72fr)!important;gap:clamp(28px,4vw,58px)!important}
.tiktok-download-card{padding:clamp(22px,3vw,32px)!important}
.workspace-head{margin-bottom:20px!important}
.page-tiktok .url-input-group{
  grid-template-columns:minmax(0,1fr) 150px 150px minmax(190px,.75fr)!important;
  gap:8px!important; padding:8px!important; align-items:stretch!important;
}
.page-tiktok .url-input-group .url-input{grid-column:1/-1!important;border:1px solid var(--fx-line)!important;background:var(--fx-card)!important}
.page-tiktok #pasteBtn,.page-tiktok #clearBtn{grid-row:2!important}
.page-tiktok #downloadBtn{grid-column:3/5!important;grid-row:2!important;min-height:50px!important}

/* Trust row: only direct chips are styled. This removes the box-inside-box bug
   caused by styling nested [data-lang] spans as independent chips. */
.trust-row{display:flex!important;flex-wrap:wrap!important;gap:8px 10px!important;padding-top:16px!important}
.trust-row > span{
  display:inline-flex!important;align-items:center!important;gap:7px!important;
  min-height:34px!important;padding:0 10px!important;border:1px solid var(--fx-line)!important;
  border-radius:999px!important;background:var(--fx-canvas-soft)!important;
}
.trust-row > span::before{content:""!important;width:5px!important;height:5px!important;border-radius:50%!important;background:var(--fx-success)!important;flex:0 0 auto!important}
.trust-row > span > [data-lang]{display:inline!important;min-height:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important}
.trust-row > span > [data-lang]::before{content:none!important;display:none!important}

/* Secondary panels and history */
.download-secondary-grid{gap:16px!important;grid-template-columns:minmax(0,1fr) minmax(360px,.82fr)!important}
.history-items{grid-template-columns:1fr!important}
.history-item{grid-template-columns:64px minmax(0,1fr)!important;gap:12px!important;padding:12px!important}
.history-thumb{width:64px!important;height:64px!important}
.history-actions{display:grid!important;grid-template-columns:minmax(90px,1fr) minmax(90px,1fr) 42px!important;gap:8px!important;margin-top:5px!important}
.history-actions .btn{min-height:38px!important;padding:0 10px!important;gap:6px!important;white-space:nowrap!important}
.fx-history-head{margin-bottom:10px!important}

/* Legal / text pages */
.page-privacy .fx-page,.page-terms .fx-page,.page-changelog .fx-page,.page-faq .fx-page{
  width:min(calc(100% - 48px),1120px)!important;padding-top:clamp(40px,5vw,64px)!important;padding-bottom:48px!important;
}
.page-privacy .fx-card,.page-terms .fx-card,.page-changelog .fx-card,.page-faq .fx-card{
  padding:clamp(26px,4.5vw,52px)!important;border-radius:18px!important;
}
.page-privacy .fx-card > [data-lang],.page-terms .fx-card > [data-lang]{max-width:900px}
.page-privacy .fx-title,.page-terms .fx-title{margin:0 0 10px!important}
.page-privacy .fx-sub,.page-terms .fx-sub{margin:0 0 30px!important;line-height:1.65!important}
.page-privacy .fx-card h3,.page-terms .fx-card h3{margin:28px 0 8px!important;font-size:18px!important;font-weight:650!important;letter-spacing:-.015em!important}
.page-privacy .fx-card p,.page-terms .fx-card p{margin:0!important;max-width:840px!important;line-height:1.72!important;font-size:15px!important}
.page-privacy .fx-card code,.page-terms .fx-card code{padding:2px 5px;border:1px solid var(--fx-line);border-radius:6px;background:var(--fx-canvas-soft)}

/* Footer — reset inherited flex ownership, then use one stable grid. */
.fx-footer.fx-footer-v860{margin-top:44px!important;padding:0!important}
.fx-footer-v860 .fx-footer-inner{
  width:min(calc(100% - 48px),var(--fx-page))!important;display:block!important;
  align-items:initial!important;justify-content:initial!important;gap:0!important;padding:34px 0 18px!important;
}
.fx-footer-v860 .fx-footer-grid{
  display:grid!important;grid-template-columns:minmax(0,1.35fr) minmax(300px,.65fr)!important;
  gap:clamp(34px,5vw,72px)!important;align-items:start!important;
}
.fx-footer-v860 .fx-footer-name{font-size:clamp(26px,2.6vw,36px)!important;margin-bottom:8px!important}
.fx-footer-v860 .fx-footer-role{margin-bottom:16px!important}
.fx-footer-v860 .fx-footer-copy{max-width:640px!important;font-size:13px!important;line-height:1.65!important}
.fx-footer-v860 .fx-footer-status{margin-top:18px!important;gap:8px 16px!important}
.fx-footer-v860 .fx-foot-links{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px 20px!important}
.fx-footer-v860 .fx-footer-contact{margin-top:18px!important}
.fx-footer-v860 .fx-footer-bottom{
  width:100%!important;display:flex!important;justify-content:space-between!important;align-items:center!important;
  flex-wrap:wrap!important;gap:8px 18px!important;margin-top:28px!important;padding-top:14px!important;
}
.fx-footer-v860 .fx-footer-credit{width:100%!important;margin-top:12px!important;padding-top:12px!important}

@media (max-width:900px){
  :root{--fx-page:1200px}
  .home-shell,.page-tiktok .container-sm{width:calc(100% - 28px)!important}
  .home-hero{grid-template-columns:1fr!important;gap:34px!important}
  .home-hero .product-window{max-width:720px}
  .download-secondary-grid{grid-template-columns:1fr!important}
  .fx-footer-v860 .fx-footer-grid{grid-template-columns:1fr!important;gap:28px!important}
}

@media (max-width:760px){
  .fx-lang-picker{height:38px;min-width:66px;border-radius:12px}
  .fx-lang-picker::before{margin-left:8px}
  .fx-lang-select{font-size:9px;padding-left:5px!important;padding-right:19px!important}
  .fx-lang-picker::after{right:6px}

  .home-shell,.page-tiktok .container-sm,.container,.fx-page{width:calc(100% - 20px)!important}
  .home-hero{padding:36px 0 38px!important;gap:26px!important}
  .home-hero h1{font-size:clamp(40px,12vw,56px)!important}
  .home-hero p{margin-top:18px!important;font-size:16px!important}
  .home-hero-actions{margin-top:22px!important;display:grid!important;grid-template-columns:1fr!important}
  .home-hero-actions .btn{width:100%!important;justify-content:center!important}
  .home-section,.features-section{padding:44px 0!important}
  .section-head{margin-bottom:22px!important}
  .section-head h2{font-size:34px!important}
  .platform-card{min-height:190px!important}
  .feature-item{min-height:170px!important}
  .home-cta{padding:44px 0!important;grid-template-columns:1fr!important}

  .download-shell{padding:14px 0 24px!important}
  .tiktok-download-card{padding:12px!important}
  .workspace-head{grid-template-columns:1fr!important}
  .workspace-status{justify-self:start!important;max-width:none!important}
  .page-tiktok .url-input-group{grid-template-columns:1fr 1fr!important;padding:7px!important;gap:7px!important}
  .page-tiktok .url-input-group .url-input{grid-column:1/-1!important;grid-row:1!important;min-height:52px!important}
  .page-tiktok #pasteBtn{grid-column:1!important;grid-row:2!important}
  .page-tiktok #clearBtn{grid-column:2!important;grid-row:2!important}
  .page-tiktok #downloadBtn{grid-column:1/-1!important;grid-row:3!important;min-height:52px!important}
  .page-tiktok #pasteBtn .btn-text,.page-tiktok #clearBtn .btn-text{display:inline!important}

  .trust-row{display:grid!important;grid-template-columns:1fr 1fr!important;gap:7px!important}
  .trust-row > span{min-height:38px!important;border-radius:12px!important;justify-content:flex-start!important}

  .history-section{padding:14px!important}
  .fx-history-head{grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important}
  .fx-history-tools{grid-column:1/-1!important}
  #historyClearBtn{justify-self:end!important;width:auto!important}
  .history-item{grid-template-columns:58px minmax(0,1fr)!important;gap:10px!important;padding:10px!important}
  .history-thumb{width:58px!important;height:58px!important}
  .history-actions{grid-template-columns:1fr 1fr 40px!important;gap:6px!important}
  .history-actions .btn{min-height:36px!important;padding:0 7px!important;font-size:11px!important}

  .page-privacy .fx-page,.page-terms .fx-page,.page-changelog .fx-page,.page-faq .fx-page{width:calc(100% - 20px)!important;padding-top:28px!important}
  .page-privacy .fx-card,.page-terms .fx-card,.page-changelog .fx-card,.page-faq .fx-card{padding:22px!important;border-radius:16px!important}
  .page-privacy .fx-card h3,.page-terms .fx-card h3{margin-top:24px!important}

  .fx-footer.fx-footer-v860{margin-top:28px!important}
  .fx-footer-v860 .fx-footer-inner{width:calc(100% - 24px)!important;padding:28px 0 calc(78px + env(safe-area-inset-bottom))!important;display:block!important}
  .fx-footer-v860 .fx-footer-grid{grid-template-columns:1fr!important;gap:26px!important}
  .fx-footer-v860 .fx-foot-links{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px 16px!important}
  .fx-footer-v860 .fx-footer-bottom{display:grid!important;grid-template-columns:1fr!important;gap:6px!important;margin-top:24px!important}
  .fx-footer-v860 .fx-footer-credit{line-height:1.55!important}
}

@media (max-width:420px){
  .fx-lang-picker{min-width:58px}
  .fx-lang-select{padding-right:17px!important}
  .trust-row{grid-template-columns:1fr!important}
  .history-actions{grid-template-columns:1fr 1fr 38px!important}
  .fx-footer-v860 .fx-foot-links{grid-template-columns:1fr 1fr!important}
}

/* Mobile-device mirror: Android Chrome can restore a desktop-sized layout
   viewport. Keep the v8.7 fixes active using the recovery class as well. */
html.fx-mobile-device .fx-lang-picker{height:38px!important;min-width:64px!important;border-radius:12px!important}
html.fx-mobile-device .fx-lang-picker::before{margin-left:7px!important}
html.fx-mobile-device .fx-lang-select{font-size:9px!important;padding-left:5px!important;padding-right:17px!important}
html.fx-mobile-device .fx-theme-quick,
html.fx-mobile-device .fx-settings-trigger,
html.fx-mobile-device .fx-menu-btn{min-width:38px!important;width:38px!important;height:38px!important;min-height:38px!important;padding:0!important}
html.fx-mobile-device .page-tiktok .url-input-group{display:grid!important;grid-template-columns:1fr 1fr!important;padding:7px!important;gap:7px!important}
html.fx-mobile-device .page-tiktok .url-input-group .url-input{grid-column:1/-1!important;grid-row:1!important;min-height:52px!important}
html.fx-mobile-device .page-tiktok #pasteBtn{grid-column:1!important;grid-row:2!important}
html.fx-mobile-device .page-tiktok #clearBtn{grid-column:2!important;grid-row:2!important}
html.fx-mobile-device .page-tiktok #downloadBtn{grid-column:1/-1!important;grid-row:3!important;min-height:52px!important}
html.fx-mobile-device .trust-row{display:grid!important;grid-template-columns:1fr 1fr!important;gap:7px!important;padding-top:14px!important}
html.fx-mobile-device .trust-row > span{display:inline-flex!important;align-items:center!important;gap:7px!important;min-height:38px!important;padding:0 10px!important;border:1px solid var(--fx-line)!important;border-radius:12px!important;background:var(--fx-canvas-soft)!important}
html.fx-mobile-device .trust-row > span > [data-lang]{display:inline!important;min-height:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important}
html.fx-mobile-device .history-items{grid-template-columns:1fr!important}
html.fx-mobile-device .history-item{grid-template-columns:58px minmax(0,1fr)!important;gap:10px!important;padding:10px!important}
html.fx-mobile-device .history-thumb{width:58px!important;height:58px!important}
html.fx-mobile-device .history-actions{display:grid!important;grid-template-columns:1fr 1fr 40px!important;gap:6px!important}
html.fx-mobile-device .history-actions .btn{min-height:36px!important;padding:0 7px!important;font-size:11px!important;min-width:0!important}
html.fx-mobile-device .fx-footer-v860 .fx-footer-inner{width:calc(100% - 24px)!important;display:block!important;padding:28px 0 calc(78px + env(safe-area-inset-bottom))!important}
html.fx-mobile-device .fx-footer-v860 .fx-footer-grid{display:grid!important;grid-template-columns:1fr!important;gap:26px!important}
html.fx-mobile-device .fx-footer-v860 .fx-footer-bottom{display:grid!important;grid-template-columns:1fr!important;gap:6px!important;margin-top:24px!important}

@media (max-width:380px){
  .fx-settings-trigger{display:none!important}
  html.fx-mobile-device .fx-settings-trigger{display:none!important}
  .fx-brand-title strong{max-width:88px!important}
  .fx-lang-picker{min-width:60px!important}
}

/* Desktop home balance: let the preview actually occupy its column instead of
   leaving a large dead area on the right. */
@media (min-width:901px){
  .home-hero > div:first-child{max-width:620px!important}
  .home-hero .product-window{width:100%!important;max-width:580px!important;justify-self:end!important}
}
@media (min-width:901px){
  .home-hero{max-width:1280px!important;margin:0 auto!important}
}
/* Footer status chips have language spans inside them; only the outer item owns
   the status dot. This prevents the double-dot artifact in ID/EN/MIN. */
.fx-footer-v860 .fx-footer-status > span{display:inline-flex!important;align-items:center!important;gap:7px!important}
.fx-footer-v860 .fx-footer-status > span::before{content:""!important;width:5px!important;height:5px!important;border-radius:50%!important;background:var(--fx-success)!important;flex:0 0 auto!important}
.fx-footer-v860 .fx-footer-status > span > [data-lang]{display:inline!important;gap:0!important}
.fx-footer-v860 .fx-footer-status > span > [data-lang]::before{content:none!important;display:none!important}
