#chat-container {
  font-family: 'FredokaOne', sans-serif;
  letter-spacing: 1px;
  width: 1000px;
  max-width: 100%;
  margin: -15px auto 40px;
  color: #fff;
  border: 1px solid rgb(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.9);
}
#chat-container:hover,
#chat-container:hover .chat-header,
#chat-container:hover .chat-input-container {
  background: rgb(0, 0, 0, 0.2);
  border-color: #00ff88;
}

.chat-header {
  padding: 10px 15px;
  background: rgb(255, 255, 255, 0.1);
  text-align: center;
  border-bottom: 1px solid rgb(0, 0, 0, 0.5);
  position: relative;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.4rem;
}

#chat-messages {
  background: rgb(0, 0, 0, 0.1);
  height: 500px;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 136, 0.3) rgba(255, 255, 255, 0.1);
}

.loading-messages {
  text-align: center;
  padding: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.message-limit-indicator {
  text-align: center;
  padding: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-style: italic;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  margin-bottom: 10px;
}

.scroll-bottom-btn {
  position: absolute;
  bottom: 70px;
  right: 20px;
  background: rgba(0, 255, 136, 0.2);
  border: 1px solid #00ff88;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: none;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  z-index: 10;
}

.scroll-bottom-btn:hover {
  background: rgba(0, 255, 136, 0.4);
  transform: translateY(-2px);
}

.scroll-bottom-btn.visible {
  display: flex;
}

@keyframes levitate {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0px); }
}

.chat-message {
  font-family: 'FredokaOne', sans-serif;
  letter-spacing: 1px;
  margin: 15px auto 15px 60px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgb(0, 0, 0, 0.5);
  border-radius: 10px;
  min-width: auto;
  position: relative;
  text-align: center;
  text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.9);
  float: left;
  clear: both;
  animation: levitate 3s ease-in-out infinite;
  max-width: 70%;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  box-sizing: border-box;
}
.chat-message:nth-child(even) {
  float: right;
  background: rgb(255, 255, 255, 0.1);
  margin: 15px 60px 15px 1px;
}
.chat-message:nth-child(even)::before {
  left: auto;
  right: -8px;
  border-width: 8px 0 8px 8px;
  border-color: transparent transparent transparent rgb(0, 0, 0, 0.5);
}
.chat-message::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 10px;
  border-style: solid;
  border-width: 8px 8px 8px 0;
  border-color: transparent rgb(0, 0, 0, 0.5) transparent transparent;
}
.chat-message .sender {
  position: absolute;
  left: -65px;
  top: 0;
  width: 35px;
  height: 25px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgb(0, 0, 0, 0.5);
  overflow: hidden;
}
.chat-message .sender .flag-icon {
  width: 40px;
  height: 40px;
  object-fit: cover;
}
.chat-message:nth-child(even) .sender {
  left: auto;
  right: -65px;
}
.chat-message .sender span:first-child {
  font-size: 1.4em;
  background: rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}
.chat-message .message-content {
  text-align: center;
  line-height: 1.5;
  font-size: 1em;
  color: white;
  padding: 5px;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  max-width: 100%;
}

.chat-input-container {
  background: rgb(252, 252, 252, 0.1);
  display: flex;
  padding: 10px;
  gap: 10px;
  border-top: 1px solid rgb(0, 0, 0, 0.5);
  position: relative;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
#chat-input {
  font-family: 'FredokaOne', sans-serif;
  letter-spacing: 1px;
  flex: 1;
  padding: 12px 15px;
  border: 1px solid rgb(0, 0, 0, 0.5);
  border-radius: 10px;
  background: rgb(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.9);
}
#chat-input:focus {
  outline: none;
  background: rgb(0, 0, 0, 0.3);
  border-color: #00ff88;
}
#chat-input::placeholder {
  color: rgba(255, 255, 255, 0.9);
}

#chat-send, #chat-spin {
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'FredokaOne', sans-serif;
  padding: 6px 15px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgb(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgb(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.6s ease;
  min-width: 70px;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 1px;
  text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.9);
}
#chat-send:hover, #chat-spin:hover {
  transform: translateY(-2px) scale(1);
  background: rgb(0, 0, 0, 0.3);
  border-color: #00ff88;
}
#chat-send:active, #chat-spin:active {
  transform: translateY(0);
}

.reply-message {
  margin: 8px 0;
  padding: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.reply-message:hover {
  background: rgba(0, 255, 136, 0.2);
}

@keyframes highlight-pulse {
  0% { background-color: rgba(0, 255, 136, 0.1); }
  50% { background-color: rgba(0, 255, 136, 0.4); }
  100% { background-color: rgba(0, 255, 136, 0.1); }
}

.highlight-message {
  animation: highlight-pulse 2s ease;
}

.reply-message:before {
  content: 'Replying to:';
  position: absolute;
  top: -12px;
  left: 8px;
  font-size: 0.6em;
  color: #00ff88;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 3px;
}

.reply-sender, .reply-content {
  display: inline;
}

.reply-content {
  margin-left: 5px;
  opacity: 0.8;
}

.reply-sender {
  color: #00ff88;
  font-size: 0.8em;
  margin-bottom: 2px;
}

.reply-content {
  opacity: 0.8;
}

.message-actions {
  opacity: 1;
}

.reply-button {
  background: none;
  border: none;
  color: #00ff88;
  cursor: pointer;
  padding: 5px;
  font-size: 0.9em;
}

.reply-button:hover {
  color: #fff;
}

.like-button {
  background: none;
  border: none;
  color: #00ff88;
  cursor: pointer;
  padding: 5px;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.like-button:hover {
  color: #ff4081;
}

.like-button .like-count {
  font-size: 0.8em;
  min-width: 20px;
}

.like-button.liked {
  color: #ff4081;
}

.reply-preview {
  background: rgba(0, 255, 136, 0.1);
  padding: 5px 2px;
  margin: 0;
  border-radius: 4px;
  width: 100%;
  position: relative;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.reply-preview-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #00ff88;
  font-size: 0.9em;
}

.cancel-reply {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 2px 5px;
}

.chat-message img {
  max-width: 80px;
  height: auto;
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: pan-y;
}

#chat-messages {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.chat-message:has(img[src*="oiia_spin_breakout.gif"]) {
  background: rgb(0, 255, 0, 0.9);
  border: 1px solid rgb(0, 0, 0, 0.5);
}

.chat-message:has(img[src*="oiia_spin_breakout.gif"]) .message-actions {
  display: none;
}

.chat-cooldown {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  color: #ff4444;
  font-size: 0.8rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.chat-cooldown.active {
  opacity: 1;
}

@media (max-width: 768px) {
  .chat-input-container {
    flex-wrap: nowrap;
    gap: 5px;
  }

  #chat-send, #chat-spin {
    flex: 0 0 35px;
    font-size: 10px;
    padding: 5px;
    min-width: unset;
    text-transform: none;
    height: 30px;
  }
  #chat-input {
    flex: 1;
    min-width: 100px;
    font-size: 10px;
    padding: 5px 10px;
  }
  #chat-messages {
    height: 400px;
  }

  #chat-container {
    max-width: 90%;
  }

  .chat-message {
    margin: 15px auto 15px 45px;
    max-width: 80%;
  }

  .chat-message:nth-child(even) {
    margin: 15px 45px 15px 1px;
  }

  .chat-message .sender {
    left: -45px;
  }

  .chat-message:nth-child(even) .sender {
    right: -45px;
  }

  .reply-message {
    margin: 15px 0 8px 0;
    padding: 6px;
  }

  .reply-message:before {
    font-size: 0.6em;
    top: -12px;
  }
}



/* Help Icon and Popup */
.help-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.6s ease;
}
.help-icon:hover {
  transform: translateY(-2px) scale(1);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.6), 
              0 0 40px rgba(0, 255, 136, 0.3);
  background: rgba(0, 255, 136, 0.15);
  border-color: #00ff88;
}
.help-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 20px;
  border-radius: 10px;
  width: 80%;
  max-width: 400px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 9999999; /* Ultra high z-index to ensure visibility */
  pointer-events: auto;
  -webkit-transform: translate(-50%, -50%) translateZ(0);
  will-change: transform; /* Hint to browser this element will change */
}
.help-popup.active {
  display: block;
}
.help-popup h3 {
  margin: 0 0 15px;
  font-size: 1.2rem;
}
.help-popup p {
  margin: 10px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.help-popup .close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.3s ease;
}
.help-popup .close-btn:hover {
  color: white;
}
