.login-box { position: fixed; /* changed from absolute to fixed so it centers relative to the viewport */ align-items: center; justify-content: center; top: 50%; left: 50%; transform: translate(-50%, -50%); /* center exactly */ display: flex; width: 100%; max-width: 420px; /* keeps box from stretching too wide */ padding: 1rem; z-index: 2; /* above particles */ } .login-card { max-width: 400px; width: 100%; border: none; border-radius: 1rem; box-shadow: 0 4px 20px rgba(0,0,0,0.1); position: relative; z-index: 3; /* ensure card sits above the particles */ } #particles-js { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; /* behind content */ pointer-events: none; /* allow clicks through particles */ background-repeat: no-repeat; background-size: cover; }