/* Waxlight PWA + mobile-first extras. Desktop layout is unchanged:
   every layout tweak lives in a max-width:767px query (or uses a 0 safe-area).
   Buttons are never underlined. */
.wx-install a,.wx-install a:link,.wx-install a:visited,.wx-install a:hover,.wx-install a:focus,.wx-install a:active,
.wx-install .btn,.wx-install .btn:hover,.wx-install .btn:focus,.wx-install .btn:active,
.wx-install-go,.wx-install-go:hover,.wx-install-go:focus,.wx-install-go:active,
.wx-install-close,.wx-install-close:hover,.wx-install-close:focus,.wx-install-close:active{
  text-decoration:none!important;
}

.wx-install{
  position:fixed;left:12px;right:12px;top:calc(var(--wx-nav-h, 69px) + 8px + env(safe-area-inset-top, 0px));
  z-index:120;
  display:flex;align-items:flex-start;gap:12px;
  background:rgba(255,255,255,.96);
  backdrop-filter:saturate(1.6) blur(18px);
  -webkit-backdrop-filter:saturate(1.6) blur(18px);
  border:1px solid rgba(61,44,110,.14);
  border-radius:20px;
  box-shadow:0 18px 40px -18px rgba(28,20,56,.45);
  padding:12px 12px 12px 14px;
  color:#1D1D1F;
  max-width:520px;
  margin:0 auto;
}
.wx-install[hidden]{display:none!important}
.wx-install::before{
  content:"";position:absolute;left:16px;right:16px;top:0;height:3px;border-radius:0 0 3px 3px;
  background:linear-gradient(90deg,#3D2C6E,#E8553D,#F4C56D);
}
.wx-install-mark{flex:none;width:36px;height:36px;border-radius:10px;margin-top:2px}
.wx-install-copy{min-width:0;flex:1}
.wx-install-k{margin:0;font-size:11px;font-weight:750;letter-spacing:.08em;text-transform:uppercase;color:#3D2C6E}
.wx-install-title{margin:3px 0 0;font-size:15.5px;font-weight:800;letter-spacing:-.02em;color:#1C1438;line-height:1.25}
.wx-install-sub{margin:4px 0 0;font-size:13px;line-height:1.4;color:#585860}
.wx-install-sub b{color:#1C1438;font-weight:700}
.wx-install-sub svg{display:inline-block;vertical-align:-3px;color:#3D2C6E}
.wx-install-actions{display:flex;flex-direction:column;align-items:stretch;gap:6px;flex:none}
.wx-install-go{
  min-height:44px;padding:0 16px;border:0;border-radius:999px;cursor:pointer;
  background:#3D2C6E;color:#fff;font:650 14px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.wx-install-go:hover{background:#4B3888;color:#fff}
.wx-install-close{
  min-height:44px;padding:0 12px;border:0;border-radius:999px;cursor:pointer;
  background:transparent;color:#3D2C6E;font:650 13px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.wx-install-close:hover{background:#EEEAF7}

/* Safe-area: 0 on desktop, so layout is unchanged there. */
.nav{
  padding-top:env(safe-area-inset-top, 0px);
}
html{--wx-nav-h: calc(69px + env(safe-area-inset-top, 0px));}

@media (max-width:767px){
  /* overflow-x:hidden on html/body computes overflow-y to auto and breaks position:sticky on iOS WebKit / Capacitor. clip does not. */
  html,body{overflow-x:hidden;overflow-x:clip;max-width:100%}
  body{padding-left:env(safe-area-inset-left, 0px);padding-right:env(safe-area-inset-right, 0px)}

  /* 44px tap targets — overrides the compact 36px nav CTAs on phones only */
  .nav-cta-m,.nav-cta-studio-m,.nav-toggle,
  .btn,.btn-sm,.btn-ghost,.btn-primary,.btn-secondary,
  .link-more,.chip-btn,.tracks button,.foot-links a,
  .pc-opt,.wx-idea-go,.wx-oauth-btn,.oauth-btn,.wx-plans button,
  .wx-seg-btn,.wx-tool,.menu-btn,.side-close,.wx-float-iconbtn,
  .wx-float-back,.wx-install-go,.wx-install-close{
    min-height:44px!important;
  }
  .nav-toggle{width:44px!important;height:44px!important;margin-left:4px}
  .nav-cta-m,.nav-cta-studio-m{min-height:44px!important;padding:0 14px!important;font-size:14px!important}
  .nav-in{height:auto;min-height:56px;padding-top:4px;padding-bottom:4px;gap:8px}
  .menu-btn,.side-close{width:44px!important;height:44px!important}
  .wx-tool{width:44px!important;height:44px!important}
  .wx-float-iconbtn{width:44px!important;height:44px!important}
  .wx-seg-btn{height:44px!important}
  .mobile-bar{height:auto;min-height:calc(48px + env(safe-area-inset-top, 0px));padding-top:env(safe-area-inset-top, 0px);padding-left:12px;padding-right:12px}

  /* Idea entry: tall, 16px type (no iOS zoom), Start stays thumb-reachable on the right */
  .wx-dock .compose{
    padding:10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    gap:10px;
  }
  .wx-dock .compose textarea{
    min-height:76px;max-height:180px;font-size:16px;padding:14px 16px;line-height:1.4;
  }
  .wx-dock .compose .btn{min-height:44px;min-width:72px;align-self:flex-end}
  .compose textarea{font-size:16px}

  /* Floating plan / sign-in card and signed-in plan dock must fit a 390px screen */
  .wx-float-wrap{left:10px;right:10px;bottom:calc(12px + env(safe-area-inset-bottom, 0px))}
  .wx-float-card{max-width:100%;width:100%}
  .wx-float-card[data-stage="signed"]{max-width:100%}
  .wx-signed-dock{align-items:stretch;gap:8px}
  .wx-signed-dock .btn{min-height:44px;flex:1 1 auto}
  .wx-plan-badge{min-height:44px;padding:0 14px}
  .wx-float-iconbtn{flex:none}
  .wx-tier-btn{min-height:44px}
  .wx-tier-go{min-height:28px}
  .wx-float-form input{min-height:44px;font-size:16px}
  .wx-oauth-btn{min-height:44px}

  /* Launcher clears the home indicator */
  .wx-launcher{bottom:calc(16px + env(safe-area-inset-bottom, 0px));right:calc(16px + env(safe-area-inset-right, 0px))}
  body.wx-min-dock[data-wx-dock="left"] .wx-launcher{left:calc(16px + env(safe-area-inset-left, 0px));right:auto}

  /* Hero CTAs stay in the thumb zone and do not overflow */
  .hero-cta{width:100%}
  .hero-cta .btn{width:100%;max-width:none}
  .wrap{padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px))}

  .wx-install{
    left:10px;right:10px;
    top:auto;
    bottom:auto;
    /* Sit just under the nav so it does not cover the composer */
    top:calc(var(--wx-nav-h, 60px) + 8px);
    max-width:none;
  }
}

/* When already running as an installed app, hide any leftover hint */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui){
  .wx-install{display:none!important}
}

/* 27 Nov 2026: 44px tap targets for the small links and toggles found in the 390px check */
@media (max-width: 767px) {
  #wxFinderLink { display: inline-flex; align-items: center; min-height: 44px; }
  #wxFloatModeSignup, #wxFloatModeLogin { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  #tabIdeas, #tabTools, #logoutBtn { min-height: 44px; }
}
