  Coalescence of neutron stars gives rise to kilonova, thermal emission powered
by radioactive decays of freshly synthesized r-process nuclei. Although
observational properties are largely affected by bound-bound opacities of
r-process elements, available atomic data have been limited. In this paper, we
study element-to-element variation of the opacities in the ejecta of neutron
star mergers by performing systematic atomic structure calculations of
r-process elements for the first time. We show that the distributions of energy
levels tend to be higher as electron occupation increases for each electron
shell due to the larger energy spacing caused by larger effects of spin-orbit
and electron-electron interactions. As a result, elements with a fewer number
of electrons in the outermost shells tend to give larger contributions to the
bound-bound opacities. This implies that Fe is not representative for the
opacities of light r-process elements. The average opacities for the mixture of
r-process elements are found to be kappa ~ 20-30 cm^2 g^{-1} for the electron
fraction of Ye < 0.20, kappa ~ 3-5 cm^2 g^{-1} for Ye = 0.25-0.35, and kappa ~
1 cm^2 g^{-1} for Ye = 0.40 at T = 5,000-10,000 K, and they steeply decrease at
lower temperature. We show that, even with the same abundance or Ye, the
opacity in the ejecta changes with time by one order of magnitude from 1 to 10
days after the merger. Our radiative transfer simulations with the new opacity
data confirm that ejecta with a high electron fraction (Ye >~ 0.25, with no
lanthanide) are needed to explain the early, blue emission in
GW170817/AT2017gfo while lanthanide-rich ejecta (with a mass fraction of
lanthanides ~ 5 x 10^{-3}) reproduce the long-lasting near-infrared emission.
