/* 命令面板样式 */
.command-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 200px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  color: white;
  font-family: Arial, sans-serif;
  z-index: 1000;
  transition: transform 0.2s ease;
  transform-origin: top right;
  touch-action: none; /* 防止浏览器默认触摸行为 */
}

.command-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 8px 8px 0 0;
  cursor: move;
  user-select: none;
  touch-action: none; /* 防止浏览器默认触摸行为 */
}

.command-panel-title {
  font-size: 14px;
  font-weight: bold;
  margin: 0;
}

#toggle-command-panel {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

#toggle-command-panel.collapsed {
  transform: rotate(-90deg);
}

.command-panel-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
}

.command-panel-content.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
}

.command-button {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  padding: 8px 12px;
  text-align: left;
  transition: background-color 0.2s;
}

.command-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.command-button.active {
  background-color: rgba(0, 120, 255, 0.6);
}

/* 移动设备适配 */
@media (max-width: 768px) {
  .command-panel {
    width: 180px;
    font-size: 14px;
  }
  
  .command-button {
    padding: 10px;
    font-size: 14px;
  }
  
  /* 增加触摸目标大小 */
  #toggle-command-panel {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  
  /* 确保在移动设备上有足够的触摸区域 */
  .command-panel-header {
    padding: 10px;
  }
}

/* 为缩放添加平滑过渡 */
.command-panel {
  will-change: transform;
  transition: transform 0.2s ease;
} 