#wordDisplay {
  border: 1px solid #ccc;
  padding: 1rem;
  font-size: 1.25rem;
  background-color: #f9f9f9;
  border-radius: 8px;
  line-height: 2.5rem;
  text-align: justify;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
scroll-behavior: smooth;
  max-height: 25rem;                /* Limit to ~5 lines */
  overflow-y: hidden;               /* Hide anything beyond */
  position: relative;
  mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

#wordDisplay span {
  display: inline-block;         /* Keeps each word intact */
  white-space: nowrap;           /* Prevents word splitting */
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
}