/* Load Minecraft font */ @font-face { font-family: 'Minecraft'; src: url('https://assets.codepen.io/4175254/Minecraft.woff2') format('woff2'); } body { background-color: transparent; margin: 0; padding: 0; overflow: hidden; } #chat { position: fixed; top: 25%; /* Offset from the top */ left: 2%; /* Offset from the left */ /* width: 300px; Fixed width for the chat */ max-height: 50vh; /* Limit height to 50% of the viewport */ padding: 5px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-end; background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */ font-family: 'Minecraft', sans-serif; font-size: 16px; color: white; text-shadow: 2px 2px 0 #3f3f3f; border-radius: 0px; /* Rounded corners */ overflow-y: hidden; /* Scroll if messages exceed height */ } .message { margin-bottom: 4px; opacity: 0; animation: fadeIn 0.5s ease-in-out forwards; word-wrap: break-word; /* Prevent text overflow */ } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } /* Fade out older messages */ .message.fade-out { animation: fadeOut 0.5s ease-in-out forwards; } @keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }