#three-container {
  width: 100%;
  height: 100%;
  min-height: 500px;
  aspect-ratio: 16/9;
  position: relative;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background-color: #000;
}

.container {
  height: auto;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Chat Overlay */
.chat-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 25%;
  max-width: 320px;
  min-width: 200px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  padding: 10px;
  color: white;
  z-index: 10;
  transition: all 0.3s ease;
}

.chat-overlay.collapsed {
  width: auto;
  min-width: unset;
  height: auto;
  padding: 8px 15px;
  opacity: 0.5;
  overflow: hidden;
  white-space: nowrap;
}

.chat-overlay.collapsed:hover {
  opacity: 0.8;
}

.chat-overlay.collapsed .messages-container,
.chat-overlay.collapsed .message-input-container,
.chat-overlay.collapsed #total-active-user-count-3d-inner {
  display: none;
}

.chat-overlay.collapsed .chat-title {
  white-space: nowrap;
  display: inline-block;
  line-height: 1.2;
}

.chat-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 0.9em;
}

.chat-title {
  font-weight: bold;
  font-size: 14px;
}

.messages-container {
  height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding: 5px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  font-size: 0.85em;
}

.message-input-container {
  display: flex;
}

.message-input-container textarea {
  flex: 1;
  padding: 5px;
  border-radius: 5px;
  border: none;
  resize: none;
  height: 32px;
  font-size: 0.85em;
}

.message-input-container button {
  margin-left: 5px;
  padding: 0 8px;
  border-radius: 5px;
  border: none;
  background-color: #0078d7;
  color: white;
  cursor: pointer;
  font-size: 0.85em;
}

/* User List Overlay */
.user-list-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18%;
  max-width: 200px;
  min-width: 150px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  padding: 10px;
  color: white;
  z-index: 10;
  transition: all 0.3s ease;
}

.user-list-overlay.collapsed {
  width: auto;
  min-width: unset;
  height: auto;
  padding: 8px 15px;
  opacity: 0.5;
  overflow: hidden;
  white-space: nowrap;
}

.user-list-overlay.collapsed:hover {
  opacity: 0.8;
}

.user-list-overlay.collapsed .user-list {
  display: none;
}

.user-list-overlay.collapsed #lobby-active-user-count-3d {
  white-space: nowrap;
  display: inline-block;
  line-height: 1.2;
}

.user-list-header {
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 0.9em;
}

.user-list {
  height: 120px;
  max-height: 20vh;
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 5px;
  border-radius: 5px;
  font-size: 0.85em;
}

/* Game Controls */
.game-controls {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  padding: 8px 12px;
  color: white;
  z-index: 10;
  pointer-events: none;
  font-size: 0.8em;
  text-align: center;
}

/* Message styles */
.message-container {
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
}

.message-avatar {
  margin-right: 5px;
  flex-shrink: 0;
}

.message-avatar img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border: 1px solid #ccc;
  background-color: #fff;
}

.message-content {
  flex: 1;
  background-color: rgba(241, 241, 241, 0.2);
  padding: 4px 8px;
  border-radius: 8px;
  max-width: calc(100% - 30px);
  font-size: 0.85em;
}

.message-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  margin-bottom: 2px;
}

.message-username {
  font-weight: bold;
  color: #74c0ff;
}

.message-time {
  color: #aaa;
  font-size: 0.75em;
}

.message-text {
  word-break: break-word;
}

/* Fullscreen styles */
#three-container.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  border-radius: 0 !important;
}

/* Ensure chat overlay is visible in fullscreen */
.chat-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 25%;
  max-width: 320px;
  min-width: 200px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  padding: 10px;
  color: white;
  z-index: 10000;
  transition: all 0.3s ease;
}

.chat-overlay.collapsed {
  width: auto;
  min-width: unset;
  height: auto;
  padding: 8px 15px;
  opacity: 0.7;
  overflow: hidden;
  white-space: nowrap;
}

/* Ensure user list overlay is visible in fullscreen */
.user-list-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18%;
  max-width: 200px;
  min-width: 150px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  padding: 10px;
  color: white;
  z-index: 10000;
  transition: all 0.3s ease;
}

.user-list-overlay.collapsed {
  width: auto;
  min-width: unset;
  height: auto;
  padding: 8px 15px;
  opacity: 0.7;
  overflow: hidden;
  white-space: nowrap;
}

/* Improved fullscreen styles for UI elements */
#three-container.fullscreen .chat-overlay,
#three-container.fullscreen .user-list-overlay,
#three-container.fullscreen .game-controls {
  position: fixed !important;
  z-index: 100000 !important;
}

#three-container.fullscreen .chat-overlay {
  bottom: 20px !important;
  left: 20px !important;
  max-width: 400px !important;
  width: 30% !important;
  font-size: 1.1em !important;
}

#three-container.fullscreen .user-list-overlay {
  top: 20px !important;
  right: 20px !important;
  max-width: 300px !important;
  width: 20% !important;
  font-size: 1.1em !important;
}

#three-container.fullscreen .game-controls {
  top: 20px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 1.2em !important;
  padding: 12px 20px !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  border-radius: 15px !important;
}

/* Additional styles for collapsed elements in fullscreen */
#three-container.fullscreen .chat-overlay.collapsed,
#three-container.fullscreen .user-list-overlay.collapsed {
  width: auto !important;
  height: auto !important;
  background-color: rgba(0, 0, 0, 0.7) !important;
  padding: 8px 15px !important;
  opacity: 0.7 !important;
}

#three-container.fullscreen .chat-overlay.collapsed .chat-title,
#three-container.fullscreen .user-list-overlay.collapsed #lobby-active-user-count-3d {
  font-size: 1.1em !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  display: inline-block !important;
}

/* Dark mode compatibility for fullscreen */
.dark-mode #three-container.fullscreen .chat-overlay,
.dark-mode #three-container.fullscreen .user-list-overlay {
  background-color: rgba(40, 40, 40, 0.95);
}

.dark-mode #three-container.fullscreen .messages-container,
.dark-mode #three-container.fullscreen .user-list {
  background-color: rgba(60, 60, 60, 0.8);
}

.dark-mode #three-container.fullscreen .message-input-container textarea {
  background-color: rgba(80, 80, 80, 0.8);
  color: #f0f0f0;
}

/* Responsive adjustments for fullscreen */
@media (max-width: 1200px) {
  #three-container.fullscreen .chat-overlay {
    width: 35%;
    max-width: 350px;
  }
  
  #three-container.fullscreen .user-list-overlay {
    width: 25%;
    max-width: 250px;
  }
}

@media (max-width: 768px) {
  #three-container.fullscreen .chat-overlay,
  #three-container.fullscreen .user-list-overlay {
    width: 40%;
    max-width: 300px;
  }
  
  #three-container.fullscreen .game-controls {
    font-size: 1em;
    padding: 8px 15px;
  }
}

/* Action button styles */
.action__button {
  padding: 5px 10px;
  margin-right: 5px;
  cursor: pointer;
  background-color: rgba(0, 120, 215, 0.8);
  border: none;
  border-radius: 3px;
  color: white;
  transition: background-color 0.2s;
}

.action__button:hover {
  background-color: rgba(0, 102, 204, 1);
}

select.action__button {
  padding: 5px;
  background-color: rgba(0, 120, 215, 0.8);
  color: white;
  border: none;
  border-radius: 3px;
}

/* Fix for duplicate elements */
.duplicate-title {
  display: none;
}

/* Chat bubble animation */
@keyframes popMessage {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.message-container {
  animation: popMessage 0.3s ease-out forwards;
}

/* Dark mode compatibility */
.dark-mode .chat-overlay,
.dark-mode .user-list-overlay {
  background-color: rgba(40, 40, 40, 0.9);
  color: #f0f0f0;
}

.dark-mode .messages-container,
.dark-mode .user-list {
  background-color: #333;
  color: #f0f0f0;
}

.dark-mode .message-input-container textarea {
  background-color: #444;
  color: #f0f0f0;
  border-color: #555;
}

/* User nametag styles */
.nametag {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -100%);
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark-mode .nametag {
  background-color: rgba(40, 40, 40, 0.8);
  color: white;
}

/* Fullscreen styles for collapsed elements */
#three-container.fullscreen .chat-overlay.collapsed,
#three-container.fullscreen .user-list-overlay.collapsed {
  background-color: rgba(0, 0, 0, 0.7);
  padding: 8px 15px;
  height: auto;
}

#three-container.fullscreen .chat-overlay.collapsed .chat-title,
#three-container.fullscreen .user-list-overlay.collapsed #lobby-active-user-count-3d {
  font-size: 1.1em;
  line-height: 1.3;
} 